StoreBackEnd/cmd/main.go

32 lines
835 B
Go

package main
import (
"_StorBackEnd/pkg/network"
"_StorBackEnd/pkg/protocol/managers"
"_StorBackEnd/pkg/protocol/repository"
"_StorBackEnd/pkg/protocol/rules/writers"
)
const (
MULTICAST_ADDRESS = "226.66.66.1:42500"
MULTICAST_SECOND = 10 // TODO : Changer en 30 secondes
UNICAST_ADDRESS = "0.0.0.0:58000"
)
func main() {
println("StorBackEnd started !")
protocolRepository := repository.CreateProtocolRepository()
helloRule := writers.CreateHelloRule("")
protocolRepository.AddWriter(&helloRule)
multicast := network.CreateClientMulticast(MULTICAST_ADDRESS, MULTICAST_SECOND, protocolRepository)
go multicast.Run()
requestManager := managers.RequestManager{Repository: protocolRepository}
server := network.ServerUnicast{Network: "tcp", Address: UNICAST_ADDRESS, ReqManager: &requestManager}
server.Run()
}