diff --git a/client/notificationBot_test.go b/client/notificationBot_test.go index e36353708286098bc77d058a17b40777fa2cd9be..e93e84aefa4d198feb5c1caee4af836f7241b84f 100644 --- a/client/notificationBot_test.go +++ b/client/notificationBot_test.go @@ -49,7 +49,7 @@ func TestRegisterForNotifications(t *testing.T) { } -//Smoke test for UnregisterForNotifications +// Smoke test for UnregisterForNotifications func TestUnregisterForNotifications(t *testing.T) { testId := id.NewIdFromString("test", id.Generic, t) clientId := id.NewIdFromString("client", id.Generic, t) diff --git a/mixmessages/ndf_test.go b/mixmessages/ndf_test.go index 12490c944806d498a6c3218de75a0bfff8391f7a..e1ab4763dccdf1c4d6c2bd810925bc7369c6a51b 100644 --- a/mixmessages/ndf_test.go +++ b/mixmessages/ndf_test.go @@ -21,7 +21,8 @@ import ( // Ensure message type conforms to genericSignable interface // If this ever fails, check for modifications in the source library -// as well as for this message type +// +// as well as for this message type var _ = signature.GenericRsaSignable(&NDF{}) // ------------------------------------ Get tests ------------------------------------------ diff --git a/mixmessages/roundError_test.go b/mixmessages/roundError_test.go index 84593ef989131f93824a743c16dbcafdf2adc4a3..48c61455aa944a948968f9023a303b8710fa300d 100644 --- a/mixmessages/roundError_test.go +++ b/mixmessages/roundError_test.go @@ -21,7 +21,8 @@ import ( // Ensure message type conforms to genericSignable interface // If this ever fails, check for modifications in the crypto library -// as well as for this message type +// +// as well as for this message type var _ = signature.GenericRsaSignable(&RoundError{}) // -------------------------------- Get tests ----------------------------------------------------------- diff --git a/mixmessages/roundInfo_test.go b/mixmessages/roundInfo_test.go index 9a8cc76093a509e2fae6a8f41cb314f0bbc77fbe..334dbdb25b15c5c5f09c7dce08cd7bdb73904d0f 100644 --- a/mixmessages/roundInfo_test.go +++ b/mixmessages/roundInfo_test.go @@ -23,7 +23,8 @@ import ( // Ensure message type conforms to genericSignable interface // If this ever fails, check for modifications in the source library -// as well as for this message type +// +// as well as for this message type var _ = signature.GenericRsaSignable(&RoundInfo{}) var _ = signature.GenericEccSignable(&RoundInfo{}) diff --git a/mixmessages/sharePiece_test.go b/mixmessages/sharePiece_test.go index b73978a8aeb8d42738bac015317db17b2e2ad28d..0ee2c55d6c5b8682069bf4354ebde860c06af1df 100644 --- a/mixmessages/sharePiece_test.go +++ b/mixmessages/sharePiece_test.go @@ -21,7 +21,8 @@ import ( // Ensure message type conforms to genericSignable interface // If this ever fails, check for modifications in the source library -// as well as for this message type +// +// as well as for this message type var _ = signature.GenericRsaSignable(&SharePiece{}) // -------------------------- Signature tests -------------------------------------- diff --git a/network/dataStructures/circuit.go b/network/dataStructures/circuit.go index 8fff00ea23387a8bb9cf093a55dce8b1701c1a66..ef82be8fd9a0842123aac4a8db88fafdca0991b3 100644 --- a/network/dataStructures/circuit.go +++ b/network/dataStructures/circuit.go @@ -141,7 +141,7 @@ func (c *Circuit) GetOrdering() []*Circuit { return circuits } -//GetHostAtIndex: Gets host at requested index. Panics if index is outside +// GetHostAtIndex: Gets host at requested index. Panics if index is outside // of the range of the list func (c *Circuit) GetHostAtIndex(index int) *connect.Host { if index < 0 || index >= len(c.hosts) { @@ -151,7 +151,7 @@ func (c *Circuit) GetHostAtIndex(index int) *connect.Host { return c.hosts[index] } -//SetHosts takes a list of hosts and copies them into the list of hosts in +// SetHosts takes a list of hosts and copies them into the list of hosts in // the circuit object func (c *Circuit) AddHost(newHost *connect.Host) { c.hosts = append(c.hosts, newHost) diff --git a/network/dataStructures/circuit_test.go b/network/dataStructures/circuit_test.go index 3e2a81741c4f572d7218a3f9eceeba1d9d13cdfe..f9f9ed60672e73141d50d31d46f6ecf8e2035ab3 100644 --- a/network/dataStructures/circuit_test.go +++ b/network/dataStructures/circuit_test.go @@ -16,7 +16,7 @@ import ( "testing" ) -//Tests the happy path of NewCircuit +// Tests the happy path of NewCircuit func TestNew(t *testing.T) { nodeIdList := makeTestingNodeIdList(5, t) @@ -60,7 +60,7 @@ func TestNew(t *testing.T) { } } -//Tests that New circuit properly errors when a list with duplicate nodes is passed +// Tests that New circuit properly errors when a list with duplicate nodes is passed func TestNew_Duplicate(t *testing.T) { nodeIdList := makeTestingNodeIdList(5, t) @@ -78,7 +78,7 @@ func TestNew_Duplicate(t *testing.T) { } -//Tests that New circuit properly errors when a list with duplicate nodes is passed +// Tests that New circuit properly errors when a list with duplicate nodes is passed func TestNew_LenZero(t *testing.T) { defer func() { if r := recover(); r != nil { @@ -175,7 +175,7 @@ func TestCircuit_GetNodeAtIndex_OutOfList_Greater(t *testing.T) { } -//Tests that GetHostAtIndex panics whn the passed index +// Tests that GetHostAtIndex panics whn the passed index // is len or greater func TestCircuit_GetHostAtIndex_OutOfList_Greater(t *testing.T) { nodeIdList := makeTestingNodeIdList(5, t) @@ -229,7 +229,7 @@ func TestCircuit_GetHostAtIndex(t *testing.T) { } -//Tests to see if node retrieved is in fact the last node +// Tests to see if node retrieved is in fact the last node func TestCircuit_GetLastNode(t *testing.T) { nodeIdList := makeTestingNodeIdList(23, t) circuit := NewCircuit(nodeIdList) @@ -239,7 +239,7 @@ func TestCircuit_GetLastNode(t *testing.T) { } } -//Tests that len returns the correct length +// Tests that len returns the correct length func TestCircuit_Len(t *testing.T) { for i := 1; i < 100; i++ { circuit := Circuit{nodes: make([]*id.ID, i)} @@ -251,7 +251,7 @@ func TestCircuit_Len(t *testing.T) { } } -//Tests that all nodes in the circuit return the correct next node +// Tests that all nodes in the circuit return the correct next node func TestCircuit_GetNextNode(t *testing.T) { nodeIdList := makeTestingNodeIdList(9, t) @@ -270,7 +270,7 @@ func TestCircuit_GetNextNode(t *testing.T) { } } -//Tests GetNextNode panics when the passed node is invalid +// Tests GetNextNode panics when the passed node is invalid func TestCircuit_GetNextNode_Invalid(t *testing.T) { nodeIdList := makeTestingNodeIdList(9, t) @@ -289,7 +289,7 @@ func TestCircuit_GetNextNode_Invalid(t *testing.T) { t.Errorf("Circuit.GetNextNode: did not panic with invalid nodeID") } -//Tests that all nodes in the circuit return the correct next node +// Tests that all nodes in the circuit return the correct next node func TestCircuit_GetPrevNode(t *testing.T) { nodeIdList := makeTestingNodeIdList(9, t) @@ -315,7 +315,7 @@ func TestCircuit_GetPrevNode(t *testing.T) { } } -//Tests GetPrevNode panics when the passed node is invalid +// Tests GetPrevNode panics when the passed node is invalid func TestCircuit_GetPrevNode_Invalid(t *testing.T) { nodeIdList := makeTestingNodeIdList(9, t) @@ -334,7 +334,7 @@ func TestCircuit_GetPrevNode_Invalid(t *testing.T) { t.Errorf("Circuit.GetPrevNode: did not panic with invalid nodeID") } -//Test that IsFirstNode is only true when passed first node +// Test that IsFirstNode is only true when passed first node func TestCircuit_IsFirstNode(t *testing.T) { nodeIdList := makeTestingNodeIdList(23, t) @@ -353,7 +353,7 @@ func TestCircuit_IsFirstNode(t *testing.T) { } } -//Tests that IsLastNode is only true when passed last node +// Tests that IsLastNode is only true when passed last node func TestCircuit_IsLastNode(t *testing.T) { nodeIdList := makeTestingNodeIdList(23, t) @@ -454,7 +454,7 @@ func checkShift(t *testing.T, a, b []*id.ID, rotations int) { } } -//Utility function +// Utility function func makeTestingNodeIdList(len int, t *testing.T) []*id.ID { var nodeIdList []*id.ID diff --git a/network/dataStructures/group.go b/network/dataStructures/group.go index 9ae4f51a56c63a7aa3e9a11cc56e43a8848d75ae..15fb092f0777614d2af6855b8826a0e60f761423 100644 --- a/network/dataStructures/group.go +++ b/network/dataStructures/group.go @@ -46,7 +46,8 @@ func (g *Group) GetString() string { // Update sets the group's string and cyclic.Group object // If these values have not been set yet, we set these two values // If these values are set and the newGroup is different, it errors -// as the group should be immutable after being set +// +// as the group should be immutable after being set func (g *Group) Update(newGroup string) error { g.Lock() defer g.Unlock() diff --git a/network/dataStructures/ipOverride.go b/network/dataStructures/ipOverride.go index b2320fec960595ecad8357c26ce26c78c24ba895..a1f044d4e8aea361bd87bd5250de4b20f109480a 100644 --- a/network/dataStructures/ipOverride.go +++ b/network/dataStructures/ipOverride.go @@ -12,20 +12,20 @@ import ( "sync" ) -//structure which holds a list of IP address to override +// structure which holds a list of IP address to override type IpOverrideList struct { ipOverride map[id.ID]string sync.Mutex } -//creates a new list over IP overrides +// creates a new list over IP overrides func NewIpOverrideList() *IpOverrideList { return &IpOverrideList{ ipOverride: make(map[id.ID]string), } } -//sets an id to be overridden with a specific IP address +// sets an id to be overridden with a specific IP address func (iol *IpOverrideList) Override(oid *id.ID, ip string) { iol.Lock() iol.ipOverride[*oid] = ip diff --git a/network/dataStructures/ipOverride_test.go b/network/dataStructures/ipOverride_test.go index 0fd39525a8af9bb2733885e9e7db77cebc13577e..e019c64254302802979953a48ed7fdf550953a25 100644 --- a/network/dataStructures/ipOverride_test.go +++ b/network/dataStructures/ipOverride_test.go @@ -12,7 +12,7 @@ import ( "testing" ) -//tests that NewIpOverrideList returns a properly formatted override list +// tests that NewIpOverrideList returns a properly formatted override list func TestNewIpOverrideList(t *testing.T) { nol := NewIpOverrideList() diff --git a/network/dataStructures/roundUpdates.go b/network/dataStructures/roundUpdates.go index de0f2f4149a2f445bfdedb3bfcf218e0a2ba39e1..872b1f99015aff91eb28f40dc693012b91e1dd53 100644 --- a/network/dataStructures/roundUpdates.go +++ b/network/dataStructures/roundUpdates.go @@ -52,7 +52,7 @@ func (u *Updates) GetUpdate(id int) (*pb.RoundInfo, error) { return val.(*Round).Get(), nil } -//gets all updates after a given ID +// gets all updates after a given ID func (u *Updates) GetUpdates(id int) []*pb.RoundInfo { interfaceList, err := u.updates.GetNewerById(id) diff --git a/network/historicalRoundData_test.go b/network/historicalRoundData_test.go index 22ac89ea60d6590e4cdf9e01759c084eb2d46435..32833156429e3b056864fde71eb26e2ec4934cb7 100644 --- a/network/historicalRoundData_test.go +++ b/network/historicalRoundData_test.go @@ -15,7 +15,7 @@ import ( "testing" ) -//region ERS Memory Map Impl +// region ERS Memory Map Impl // Memory map based ExtendedRoundStorage database type ersMemMap struct { rounds map[id.Round]*pb.RoundInfo diff --git a/network/instance.go b/network/instance.go index 3ecbe548fa7006aa774e5b4ea154c53db767e3e6..5021145c39ea819ea918ec7d7c1edb88958d983c 100644 --- a/network/instance.go +++ b/network/instance.go @@ -250,7 +250,7 @@ func NewInstanceTesting(c *connect.ProtoComms, partial, full *ndf.NetworkDefinit return instance, nil } -//update the partial ndf +// update the partial ndf func (i *Instance) UpdatePartialNdf(m *pb.NDF) error { if i.partial == nil { return errors.New("Cannot update the partial ndf when it is nil") @@ -314,12 +314,12 @@ func (i *Instance) UpdatePartialNdf(m *pb.NDF) error { return nil } -//overrides an IP address for an ID with one from +// overrides an IP address for an ID with one from func (i *Instance) GetIpOverrideList() *ds.IpOverrideList { return i.ipOverride } -//Gets the node and gateway with the given ID +// Gets the node and gateway with the given ID func (i *Instance) GetNodeAndGateway(ngid *id.ID) (NodeGateway, error) { index := -1 @@ -364,7 +364,7 @@ func (i *Instance) GetNodeAndGateway(ngid *id.ID) (NodeGateway, error) { }, nil } -//update the full ndf +// update the full ndf func (i *Instance) UpdateFullNdf(m *pb.NDF) error { if i.full == nil { return errors.New("Cannot update the full ndf when it is nil") diff --git a/network/instance_test.go b/network/instance_test.go index 1657d91e85f97173b9b2cc863bdd08d13d50b453..bb6b80cb1cf42432b56c5f74415e15883d7d1640 100644 --- a/network/instance_test.go +++ b/network/instance_test.go @@ -117,7 +117,7 @@ func TestNewInstanceTesting_Error(t *testing.T) { } -//tests newInstance errors properly when there is no NDF +// tests newInstance errors properly when there is no NDF func TestNewInstance_NilNDFs(t *testing.T) { _, err := NewInstance(&connect.ProtoComms{}, nil, nil, nil, 0, false) if err == nil { diff --git a/network/validation.go b/network/validation.go index 5285d939945e097d2cc650d3b97aea827e34cb1c..8fe3278ab34ec285c04fec612ebff6deb1e3ee6c 100644 --- a/network/validation.go +++ b/network/validation.go @@ -10,7 +10,8 @@ package network import "fmt" // Level of validation types for pulling our round structure -// Strict: Signatures are checked every time (intended for nodes) +// +// Strict: Signatures are checked every time (intended for nodes) // Lazy: Only check we're involved, only verifies the first retrieval // None: no signature checks are done type ValidationType uint8 diff --git a/node/handler.go b/node/handler.go index 0c18f7226f6baf4d1383d7b4a0225e3dea3f538b..4a68927e9c044b8e6711593957598b0a3d803fe9 100644 --- a/node/handler.go +++ b/node/handler.go @@ -358,8 +358,9 @@ func (s *Implementation) RoundError(err *mixmessages.RoundError, auth *connect.A // Consensus node -> cMix node NDF request // NOTE: For now cMix nodes serve the NDF to the -// consensus nodes, but this will be reversed -// once consensus generates the NDF +// +// consensus nodes, but this will be reversed +// once consensus generates the NDF func (s *Implementation) GetNDF() (*interconnect.NDF, error) { return s.Functions.GetNdf() } diff --git a/publicAddress/getAddress.go b/publicAddress/getAddress.go index c07d7b975cd7b11e4035aae2c0ca8d8d59e20bc5..73738a2d9f9bc759fda1b8a8b8d649525214949d 100644 --- a/publicAddress/getAddress.go +++ b/publicAddress/getAddress.go @@ -67,7 +67,8 @@ func getIpFromList(urls []Service, timeout time.Duration) (string, error) { // getIpMultiCheck returns the caller's public IP address that is provided from // multiple Services. Services are tried one by one until the given number of -// services return the same valid IPv4 address. +// +// services return the same valid IPv4 address. func getIpMultiCheck(urls []Service, timeout time.Duration, checks int) (string, error) { serviceList := shuffleStrings(urls) var ipv6 bool