Fixed spelling mistake in project name, restructuring. Correction of Golang convention error.
This commit is contained in:
parent
c379c15932
commit
27789be202
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<module version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
9
.idea/StoreBackEnd.iml
Normal file
9
.idea/StoreBackEnd.iml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
21
cmd/main.go
21
cmd/main.go
@ -1,30 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"StorBackEnd/pkg/config"
|
||||
"StorBackEnd/pkg/network"
|
||||
"StorBackEnd/pkg/protocol/managers"
|
||||
"StorBackEnd/pkg/protocol/repository"
|
||||
"StorBackEnd/pkg/protocol/rules/readers"
|
||||
"StorBackEnd/pkg/protocol/rules/writers"
|
||||
"StoreBackEnd/pkg/config"
|
||||
"StoreBackEnd/pkg/network"
|
||||
"StoreBackEnd/pkg/protocol/managers"
|
||||
"StoreBackEnd/pkg/protocol/repository"
|
||||
"StoreBackEnd/pkg/protocol/rules/readers"
|
||||
"StoreBackEnd/pkg/protocol/rules/writers"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
FILE_PATH = "resources/AppConfig.json"
|
||||
FilePath = "resources/AppConfig.json"
|
||||
)
|
||||
|
||||
func main() {
|
||||
println("StorBackEnd started !")
|
||||
println("StoreBackEnd started !")
|
||||
|
||||
// Loading App config
|
||||
appConfig, err := config.Read(FILE_PATH)
|
||||
appConfig, err := config.Read(FilePath)
|
||||
if err != nil {
|
||||
println("Impossible de charger la configuration du server : " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
println("Adresse multicast : " + appConfig.MulticastAddress)
|
||||
println("Address multicast : " + appConfig.MulticastAddress)
|
||||
|
||||
protocolRepository := repository.CreateProtocolRepository()
|
||||
|
||||
@ -43,5 +43,4 @@ func main() {
|
||||
|
||||
server := network.ServerUnicast{Network: "tcp", Port: appConfig.UnicastPort, ReqManager: &requestManager}
|
||||
server.Run()
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ type AppConfig struct {
|
||||
// multicastSecond Contient le nombre de seconde entre chaque annonce
|
||||
MulticastSecond int `json:"multicastSecond"`
|
||||
|
||||
// domain Domain du StorBackEnd
|
||||
// domain Domain du StoreBackEnd
|
||||
Domain string `json:"domain"`
|
||||
|
||||
// unicastPort Contient le port unicast auquel le FileFrontEnd se connecte
|
||||
|
@ -1,8 +1,8 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"StorBackEnd/pkg/protocol/repository"
|
||||
"StorBackEnd/pkg/protocol/rules/writers"
|
||||
"StoreBackEnd/pkg/protocol/repository"
|
||||
"StoreBackEnd/pkg/protocol/rules/writers"
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
@ -25,7 +25,7 @@ type ClientMulticast struct {
|
||||
// address Adresse de multicast
|
||||
address string
|
||||
|
||||
// address Domain de du StorBackEnd
|
||||
// address Domain de du StoreBackEnd
|
||||
domain string
|
||||
|
||||
// port Port de connexion en unicast
|
||||
@ -57,7 +57,7 @@ func (cMult ClientMulticast) Run() {
|
||||
}
|
||||
|
||||
for {
|
||||
con.Write([]byte(cmd))
|
||||
_, _ = con.Write([]byte(cmd))
|
||||
time.Sleep(time.Second * cMult.second)
|
||||
}
|
||||
|
||||
@ -71,7 +71,6 @@ func (cMult ClientMulticast) ResolveAddr() (*net.UDPAddr, bool) {
|
||||
println(errResUdp.Error())
|
||||
return nil, true
|
||||
}
|
||||
|
||||
return addr, false
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"StorBackEnd/pkg/protocol/managers"
|
||||
"StoreBackEnd/pkg/protocol/managers"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -36,7 +36,7 @@ func (server ServerUnicast) Run() {
|
||||
}
|
||||
|
||||
result := server.ReqManager.Execute(line)
|
||||
con.Write(append([]byte(result), '\n')) // TODO : ATTENTION laisser les \n
|
||||
_, _ = con.Write(append([]byte(result), '\n')) // TODO : ATTENTION laisser les \n
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package managers
|
||||
|
||||
import "StorBackEnd/pkg/protocol/repository"
|
||||
import "StoreBackEnd/pkg/protocol/repository"
|
||||
|
||||
type RequestManager struct {
|
||||
Repository *repository.ProtocolRepository
|
||||
|
@ -1,6 +1,6 @@
|
||||
package repository
|
||||
|
||||
import "StorBackEnd/pkg/protocol"
|
||||
import "StoreBackEnd/pkg/protocol"
|
||||
|
||||
func CreateProtocolRepository() *ProtocolRepository {
|
||||
return &ProtocolRepository{
|
||||
|
@ -1,6 +1,6 @@
|
||||
package readers
|
||||
|
||||
import "StorBackEnd/pkg/protocol"
|
||||
import "StoreBackEnd/pkg/protocol"
|
||||
|
||||
// EraseFileRuleName Identifiant de cette règle
|
||||
const EraseFileRuleName = "ffe_erasefile"
|
||||
|
@ -1,6 +1,6 @@
|
||||
package writers
|
||||
|
||||
import "StorBackEnd/pkg/protocol"
|
||||
import "StoreBackEnd/pkg/protocol"
|
||||
|
||||
const HelloRuleName = "sbe_hello"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"multicastAddress" : "226.66.66.1:42500",
|
||||
"multicastSecond" : 10,
|
||||
"domain" : "benjamin",
|
||||
"domain" : "lightcontainer.storebacked-01",
|
||||
"unicastPort" : 58000
|
||||
}
|
Loading…
Reference in New Issue
Block a user