From 27789be2025e2b0870ed62aac3154ae818af5310 Mon Sep 17 00:00:00 2001 From: EndMove Date: Sat, 5 Mar 2022 17:21:46 +0100 Subject: [PATCH] Fixed spelling mistake in project name, restructuring. Correction of Golang convention error. --- .idea/ StorBackEnd.iml | 3 +-- .idea/StoreBackEnd.iml | 9 ++++++++ cmd/main.go | 21 +++++++++---------- go.mod | 2 +- pkg/config/AppConfig.go | 2 +- pkg/network/ClientMulticast.go | 9 ++++---- pkg/network/ServerUnicast.go | 4 ++-- pkg/protocol/managers/RequestManager.go | 2 +- pkg/protocol/repository/ProtocolRepository.go | 2 +- pkg/protocol/rules/readers/EraseFileRule.go | 2 +- pkg/protocol/rules/writers/HelloRule.go | 2 +- resources/AppConfig.json | 2 +- 12 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 .idea/StoreBackEnd.iml diff --git a/.idea/ StorBackEnd.iml b/.idea/ StorBackEnd.iml index 5e764c4..eeb7bce 100644 --- a/.idea/ StorBackEnd.iml +++ b/.idea/ StorBackEnd.iml @@ -1,9 +1,8 @@ - + - \ No newline at end of file diff --git a/.idea/StoreBackEnd.iml b/.idea/StoreBackEnd.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/StoreBackEnd.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index 2807cd8..5add847 100644 --- a/cmd/main.go +++ b/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() - } diff --git a/go.mod b/go.mod index 6a92a91..7b67ed0 100644 --- a/go.mod +++ b/go.mod @@ -1 +1 @@ -module StorBackEnd +module StoreBackEnd diff --git a/pkg/config/AppConfig.go b/pkg/config/AppConfig.go index 9b5e2e5..018a884 100644 --- a/pkg/config/AppConfig.go +++ b/pkg/config/AppConfig.go @@ -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 diff --git a/pkg/network/ClientMulticast.go b/pkg/network/ClientMulticast.go index 8a26121..6bb46f5 100644 --- a/pkg/network/ClientMulticast.go +++ b/pkg/network/ClientMulticast.go @@ -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 } diff --git a/pkg/network/ServerUnicast.go b/pkg/network/ServerUnicast.go index ecb24ed..2ff83c0 100644 --- a/pkg/network/ServerUnicast.go +++ b/pkg/network/ServerUnicast.go @@ -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 } } diff --git a/pkg/protocol/managers/RequestManager.go b/pkg/protocol/managers/RequestManager.go index 9c0b7d2..4228335 100644 --- a/pkg/protocol/managers/RequestManager.go +++ b/pkg/protocol/managers/RequestManager.go @@ -1,6 +1,6 @@ package managers -import "StorBackEnd/pkg/protocol/repository" +import "StoreBackEnd/pkg/protocol/repository" type RequestManager struct { Repository *repository.ProtocolRepository diff --git a/pkg/protocol/repository/ProtocolRepository.go b/pkg/protocol/repository/ProtocolRepository.go index 9e613c5..e5ee8ac 100644 --- a/pkg/protocol/repository/ProtocolRepository.go +++ b/pkg/protocol/repository/ProtocolRepository.go @@ -1,6 +1,6 @@ package repository -import "StorBackEnd/pkg/protocol" +import "StoreBackEnd/pkg/protocol" func CreateProtocolRepository() *ProtocolRepository { return &ProtocolRepository{ diff --git a/pkg/protocol/rules/readers/EraseFileRule.go b/pkg/protocol/rules/readers/EraseFileRule.go index 0d75f14..e6a9de8 100644 --- a/pkg/protocol/rules/readers/EraseFileRule.go +++ b/pkg/protocol/rules/readers/EraseFileRule.go @@ -1,6 +1,6 @@ package readers -import "StorBackEnd/pkg/protocol" +import "StoreBackEnd/pkg/protocol" // EraseFileRuleName Identifiant de cette règle const EraseFileRuleName = "ffe_erasefile" diff --git a/pkg/protocol/rules/writers/HelloRule.go b/pkg/protocol/rules/writers/HelloRule.go index e2d3cf6..e61f26b 100644 --- a/pkg/protocol/rules/writers/HelloRule.go +++ b/pkg/protocol/rules/writers/HelloRule.go @@ -1,6 +1,6 @@ package writers -import "StorBackEnd/pkg/protocol" +import "StoreBackEnd/pkg/protocol" const HelloRuleName = "sbe_hello" diff --git a/resources/AppConfig.json b/resources/AppConfig.json index a25c31e..d878c64 100644 --- a/resources/AppConfig.json +++ b/resources/AppConfig.json @@ -1,6 +1,6 @@ { "multicastAddress" : "226.66.66.1:42500", "multicastSecond" : 10, - "domain" : "benjamin", + "domain" : "lightcontainer.storebacked-01", "unicastPort" : 58000 } \ No newline at end of file