diff --git a/net/ip.go b/net/ip.go index 44b84d192402d5e309ea9e394ee5237664cecae2..4392fd1941729cdb98c8cf73f73ac4dd10c8eba9 100644 --- a/net/ip.go +++ b/net/ip.go @@ -59,7 +59,7 @@ func IPFromBytes(b []byte) (IP, error) { uint16(b[14])<<8+uint16(b[15])), nil } - return IP{}, fmt.Errorf("byte slice has an invalid legth. Expected either 4 (IPv4) or 16 (IPv6) bytes but got: %d", len(b)) + return IP{}, fmt.Errorf("byte slice has an invalid length. Expected either 4 (IPv4) or 16 (IPv6) bytes but got: %d", len(b)) } // IPFromString returns an IP address for a given string diff --git a/protocols/bgp/packet/bgp.go b/protocols/bgp/packet/bgp.go index 80c79ae74fe72e38a5afb2267bc32a35a021d38b..ec7593030e4b738a437767fbba51975485d2e161 100644 --- a/protocols/bgp/packet/bgp.go +++ b/protocols/bgp/packet/bgp.go @@ -48,7 +48,7 @@ const ( // Update Msg Errors MalformedAttributeList = 1 UnrecognizedWellKnownAttr = 2 - MissingWellKnonAttr = 3 + MissingWellKnownAttr = 3 AttrFlagsError = 4 AttrLengthError = 5 InvalidOriginAttr = 6 @@ -90,7 +90,7 @@ const ( ConnectionRejected = 5 OtherConfigChange = 8 ConnectionCollisionResolution = 7 - OutOfResoutces = 8 + OutOfResources = 8 IPv4AFI = 1 IPv6AFI = 2 diff --git a/protocols/bgp/packet/decoder.go b/protocols/bgp/packet/decoder.go index 2abfeec67a6761723119a4b8d6e2719f99649239..494b1f39bebedbe6058b62d19daba23c62cc6a43 100644 --- a/protocols/bgp/packet/decoder.go +++ b/protocols/bgp/packet/decoder.go @@ -186,7 +186,7 @@ func decodeOptParams(buf *bytes.Buffer, optParmLen uint8) ([]OptParam, error) { case CapabilitiesParamType: caps, err := decodeCapabilities(buf, o.Length) if err != nil { - return nil, fmt.Errorf("Unable to decode capabilites: %v", err) + return nil, fmt.Errorf("Unable to decode capabilities: %v", err) } o.Value = caps diff --git a/protocols/bgp/packet/decoder_test.go b/protocols/bgp/packet/decoder_test.go index 74e5b84f978f084c38360b85b72030fe79fe945e..d76507bc74c0fdc6be67bf2cec98ee3d0bbba23a 100644 --- a/protocols/bgp/packet/decoder_test.go +++ b/protocols/bgp/packet/decoder_test.go @@ -36,11 +36,11 @@ func BenchmarkDecodeUpdateMsg(b *testing.B) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -491,7 +491,7 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 6, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 }, @@ -550,7 +550,7 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 6, // Length 1, // Type = AS_SET - 0, // Path Segement Length + 0, // Path Segment Length }, wantFail: true, }, @@ -569,7 +569,7 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 6, // Length 3, // Type = INVALID - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 }, @@ -590,11 +590,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 }, @@ -660,11 +660,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -746,11 +746,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -845,11 +845,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -957,11 +957,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -1081,11 +1081,11 @@ func TestDecodeUpdateMsg(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 diff --git a/protocols/bgp/packet/encoder.go b/protocols/bgp/packet/encoder.go index 122bca972219f246346b263f666554a13f035b04..27bd3397e40109b02237fff903d020551136e09d 100644 --- a/protocols/bgp/packet/encoder.go +++ b/protocols/bgp/packet/encoder.go @@ -25,10 +25,10 @@ func SerializeNotificationMsg(msg *BGPNotification) []byte { } func SerializeOpenMsg(msg *BGPOpen) []byte { - optParmsBuf := bytes.NewBuffer(make([]byte, 0)) - serializeOptParams(optParmsBuf, msg.OptParams) - optParms := optParmsBuf.Bytes() - openLen := uint16(len(optParms) + MinOpenLen) + optParamsBuf := bytes.NewBuffer(make([]byte, 0)) + serializeOptParams(optParamsBuf, msg.OptParams) + optParams := optParamsBuf.Bytes() + openLen := uint16(len(optParams) + MinOpenLen) buf := bytes.NewBuffer(make([]byte, 0, openLen)) serializeHeader(buf, openLen, OpenMsg) @@ -38,8 +38,8 @@ func SerializeOpenMsg(msg *BGPOpen) []byte { buf.Write(convert.Uint16Byte(msg.HoldTime)) buf.Write(convert.Uint32Byte(msg.BGPIdentifier)) - buf.WriteByte(uint8(len(optParms))) - buf.Write(optParms) + buf.WriteByte(uint8(len(optParams))) + buf.Write(optParams) return buf.Bytes() } diff --git a/protocols/bgp/server/fsm_test.go b/protocols/bgp/server/fsm_test.go index ba0e1429e41d4ccd4d65837142a8a7d456d6df6a..aae0d7dc20347635e28c84d88b2a062f9e28ff68 100644 --- a/protocols/bgp/server/fsm_test.go +++ b/protocols/bgp/server/fsm_test.go @@ -76,11 +76,11 @@ func TestFSM255UpdatesIPv4(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 @@ -188,11 +188,11 @@ func TestFSM255UpdatesIPv6(t *testing.T) { 2, // Attribute Type code (AS Path) 12, // Length 2, // Type = AS_SEQUENCE - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 1, // Type = AS_SET - 2, // Path Segement Length + 2, // Path Segment Length 59, 65, // AS15169 12, 248, // AS3320 diff --git a/route/bgp_path.go b/route/bgp_path.go index bf95c53943405e05002764f7aa0719d133debdca..e2fe080c30885b439c72e7528ce86c076a0a3f72 100644 --- a/route/bgp_path.go +++ b/route/bgp_path.go @@ -121,7 +121,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return 1 } - // e) TODO: interiour cost (hello IS-IS and OSPF) + // e) TODO: interior cost (hello IS-IS and OSPF) // f) + RFC4456 9. (Route Reflection) bgpIdentifierC := c.BGPIdentifier diff --git a/route/path_test.go b/route/path_test.go index b7545431b82c562e2e9e37cd921e950bf117f528..3d3f5a279f3d29525aa4a3724fa8f1c88016398a 100644 --- a/route/path_test.go +++ b/route/path_test.go @@ -70,7 +70,7 @@ func TestPathsDiff(t *testing.T) { }, }, { - name: "Disjunkt", + name: "Disjunct", any: []*Path{ { Type: 10, diff --git a/route/route.go b/route/route.go index e6b46ee6bd3e4bd69927f9cb97ec386dae0aaa56..51d00db5c860ba6aff88023da0449f17ff2a8cf5 100644 --- a/route/route.go +++ b/route/route.go @@ -219,7 +219,7 @@ func getBestProtocol(paths []*Path) uint8 { return best } -// Print returns a prinatble representation of route `r` +// Print returns a printable representation of route `r` func (r *Route) Print() string { ret := fmt.Sprintf("%s:\n", r.pfx.String()) ret += fmt.Sprintf("All Paths:\n") diff --git a/routingtable/adjRIBOut/adj_rib_out_test.go b/routingtable/adjRIBOut/adj_rib_out_test.go index 51465849d2e14bfb17086cbff14561c4f8b7eefe..70004a32edac2f396d084b722dfa165b7bf56b9d 100644 --- a/routingtable/adjRIBOut/adj_rib_out_test.go +++ b/routingtable/adjRIBOut/adj_rib_out_test.go @@ -861,7 +861,7 @@ func TestBestPathOnlyRRClient(t *testing.T) { } /* - * Test for AddPath capabale peer / AdjRIBOut + * Test for AddPath capable peer / AdjRIBOut */ func TestAddPathIBGP(t *testing.T) { diff --git a/routingtable/client_manager.go b/routingtable/client_manager.go index 0bedbb45519c88bcf8a44e4b4491a76b66e590c7..b779bb0ba049f1d1f51de9fa8e70f27056fdb61e 100644 --- a/routingtable/client_manager.go +++ b/routingtable/client_manager.go @@ -39,7 +39,7 @@ func NewClientManager(master RouteTableClient) ClientManager { } } -// GetOptions gets the options for a registred client +// GetOptions gets the options for a registered client func (c *ClientManager) GetOptions(client RouteTableClient) ClientOptions { c.mu.RLock() defer c.mu.RUnlock() diff --git a/routingtable/contributing_asn_list.go b/routingtable/contributing_asn_list.go index 500b79b61d66825b6f0e9c21d3508adc970c36e3..9ac0d4870321b40eb010b80325e6c63d41bfe6e3 100644 --- a/routingtable/contributing_asn_list.go +++ b/routingtable/contributing_asn_list.go @@ -36,7 +36,7 @@ func (c *ContributingASNs) Add(asn uint32) { cASN.count++ if cASN.count == math.MaxUint32 { - panic(fmt.Sprintf("Contributing ASNs counter overflow triggered for AS %d. Dyning of shame.", asn)) + panic(fmt.Sprintf("Contributing ASNs counter overflow triggered for AS %d. Dying of shame.", asn)) } return diff --git a/routingtable/filter/filter_test.go b/routingtable/filter/filter_test.go index 0eeb4942df0938d3445a4df6598ac523fa2d577f..7a9d230bc50253796f9f0379d27b4abef42638c0 100644 --- a/routingtable/filter/filter_test.go +++ b/routingtable/filter/filter_test.go @@ -15,7 +15,7 @@ func TestProcessTerms(t *testing.T) { prefix net.Prefix path *route.Path term *Term - exptectAccept bool + expectAccept bool expectModified bool }{ { @@ -27,7 +27,7 @@ func TestProcessTerms(t *testing.T) { &actions.AcceptAction{}, }, }, - exptectAccept: true, + expectAccept: true, expectModified: false, }, { @@ -39,7 +39,7 @@ func TestProcessTerms(t *testing.T) { &actions.RejectAction{}, }, }, - exptectAccept: false, + expectAccept: false, expectModified: false, }, { @@ -52,7 +52,7 @@ func TestProcessTerms(t *testing.T) { &actions.RejectAction{}, }, }, - exptectAccept: true, + expectAccept: true, expectModified: false, }, { @@ -65,7 +65,7 @@ func TestProcessTerms(t *testing.T) { &actions.AcceptAction{}, }, }, - exptectAccept: true, + expectAccept: true, expectModified: true, }, } @@ -75,7 +75,7 @@ func TestProcessTerms(t *testing.T) { f := NewFilter([]*Term{test.term}) p, reject := f.ProcessTerms(test.prefix, test.path) - assert.Equal(t, test.exptectAccept, !reject) + assert.Equal(t, test.expectAccept, !reject) if test.expectModified { assert.NotEqual(t, test.path, p) diff --git a/routingtable/filter/term_condition.go b/routingtable/filter/term_condition.go index 9839ebe65397cb13af7bf3943761a91c108409c5..d38fab8f4c283edf738afb21ed419b0319c0f4fa 100644 --- a/routingtable/filter/term_condition.go +++ b/routingtable/filter/term_condition.go @@ -33,9 +33,9 @@ func NewTermConditionWithPrefixLists(filters ...*PrefixList) *TermCondition { func (f *TermCondition) Matches(p net.Prefix, pa *route.Path) bool { return f.matchesPrefixListFilters(p) && - f.machtchesRouteFilters(p) && - f.machtchesCommunityFilters(pa) && - f.machtchesLargeCommunityFilters(pa) + f.matchesRouteFilters(p) && + f.matchesCommunityFilters(pa) && + f.matchesLargeCommunityFilters(pa) } func (t *TermCondition) matchesPrefixListFilters(p net.Prefix) bool { @@ -52,7 +52,7 @@ func (t *TermCondition) matchesPrefixListFilters(p net.Prefix) bool { return false } -func (t *TermCondition) machtchesRouteFilters(p net.Prefix) bool { +func (t *TermCondition) matchesRouteFilters(p net.Prefix) bool { if len(t.routeFilters) == 0 { return true } @@ -66,7 +66,7 @@ func (t *TermCondition) machtchesRouteFilters(p net.Prefix) bool { return false } -func (t *TermCondition) machtchesCommunityFilters(pa *route.Path) bool { +func (t *TermCondition) matchesCommunityFilters(pa *route.Path) bool { if len(t.communityFilters) == 0 { return true } @@ -84,7 +84,7 @@ func (t *TermCondition) machtchesCommunityFilters(pa *route.Path) bool { return false } -func (t *TermCondition) machtchesLargeCommunityFilters(pa *route.Path) bool { +func (t *TermCondition) matchesLargeCommunityFilters(pa *route.Path) bool { if len(t.largeCommunityFilters) == 0 { return true } diff --git a/routingtable/neighbor.go b/routingtable/neighbor.go index b72c7a193bbf5f0867ea573aa0e0d0f94e319aab..e4a0b463217ee6573709ffb09d917ef0f59f8afe 100644 --- a/routingtable/neighbor.go +++ b/routingtable/neighbor.go @@ -19,7 +19,7 @@ type Neighbor struct { // Local ASN of session LocalASN uint32 - // RouteServerClient incicates if the peer is a route server client + // RouteServerClient indicates if the peer is a route server client RouteServerClient bool // RouteReflectorClient indicates if the peer is a route reflector client diff --git a/routingtable/table.go b/routingtable/table.go index 5fcb911c03f9706903c87ad77c80a010931b726b..a6caca25da76eab73a553c191fca2394c4b88b03 100644 --- a/routingtable/table.go +++ b/routingtable/table.go @@ -114,7 +114,7 @@ func (rt *RoutingTable) LPM(pfx net.Prefix) (res []*route.Route) { return res } -// Get get's the route for pfx from the LPM +// Get gets the route for pfx from the LPM func (rt *RoutingTable) Get(pfx net.Prefix) *route.Route { rt.mu.RLock() defer rt.mu.RUnlock() @@ -134,7 +134,7 @@ func (rt *RoutingTable) get(pfx net.Prefix) *route.Route { return res.route } -// GetLonger get's prefix pfx and all it's more specifics from the LPM +// GetLonger gets prefix pfx and all it's more specifics from the LPM func (rt *RoutingTable) GetLonger(pfx net.Prefix) (res []*route.Route) { rt.mu.RLock() defer rt.mu.RUnlock() diff --git a/testing/conn_mock.go b/testing/conn_mock.go index 2db28011a5d3080d28b1c24cde9895ebee496cd1..9c89ea64e658ad2cb5c46f91f5ac368fe9d5a436 100644 --- a/testing/conn_mock.go +++ b/testing/conn_mock.go @@ -8,7 +8,7 @@ import ( type MockConn struct { net.Conn - // Bytes are the bytes writen + // Bytes are the bytes written Bytes []byte }