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