From 76c2d331e377be838e134b18a3dee4f60c94acc0 Mon Sep 17 00:00:00 2001
From: Annika Wickert <annika.wickert@exaring.de>
Date: Tue, 16 Oct 2018 11:32:06 +0200
Subject: [PATCH] Fixed some spelling errors

---
 net/ip.go                                  |  2 +-
 protocols/bgp/packet/bgp.go                |  4 +--
 protocols/bgp/packet/decoder.go            |  2 +-
 protocols/bgp/packet/decoder_test.go       | 34 +++++++++++-----------
 protocols/bgp/packet/encoder.go            | 12 ++++----
 protocols/bgp/server/fsm_test.go           |  8 ++---
 route/bgp_path.go                          |  2 +-
 route/path_test.go                         |  2 +-
 route/route.go                             |  2 +-
 routingtable/adjRIBOut/adj_rib_out_test.go |  2 +-
 routingtable/client_manager.go             |  2 +-
 routingtable/contributing_asn_list.go      |  2 +-
 routingtable/filter/filter_test.go         | 12 ++++----
 routingtable/filter/term_condition.go      | 12 ++++----
 routingtable/neighbor.go                   |  2 +-
 routingtable/table.go                      |  4 +--
 testing/conn_mock.go                       |  2 +-
 17 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/net/ip.go b/net/ip.go
index 44b84d19..4392fd19 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 80c79ae7..ec759303 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 2abfeec6..494b1f39 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 74e5b84f..d76507bc 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 122bca97..27bd3397 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 ba0e1429..aae0d7dc 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 bf95c539..e2fe080c 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 b7545431..3d3f5a27 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 e6b46ee6..51d00db5 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 51465849..70004a32 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 0bedbb45..b779bb0b 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 500b79b6..9ac0d487 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 0eeb4942..7a9d230b 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 9839ebe6..d38fab8f 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 b72c7a19..e4a0b463 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 5fcb911c..a6caca25 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 2db28011..9c89ea64 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
 }
 
-- 
GitLab