Kaynağa Gözat

More gometalinter fixes

Rod Hynes 8 yıl önce
ebeveyn
işleme
32cdbf479b

+ 1 - 1
psiphon/common/protocol/serverEntry_test.go

@@ -105,7 +105,7 @@ func TestInvalidServerEntries(t *testing.T) {
 		}
 		err = ValidateServerEntry(serverEntry)
 		if err == nil {
-			t.Error("server entry should not validate: %s", testCase)
+			t.Errorf("server entry should not validate: %s", testCase)
 		}
 	}
 }

+ 7 - 9
psiphon/common/tun/tun.go

@@ -309,7 +309,7 @@ func (server *Server) Stop() {
 	// Wait for any in-progress ClientConnected calls to complete.
 	server.connectedInProgress.Wait()
 
-	// After this point, no futher clients will be added: all
+	// After this point, no further clients will be added: all
 	// in-progress ClientConnected calls have finished; and any
 	// later ClientConnected calls won't get past their
 	// server.runContext.Done() checks.
@@ -345,7 +345,7 @@ type AllowedPortChecker func(upstreamIPAddress net.IP, port int) bool
 //
 // It is safe to make concurrent calls to ClientConnected for distinct
 // session IDs. The caller is responsible for serializing calls with the
-// same session ID. Futher, the caller must ensure, in the case of a client
+// same session ID. Further, the caller must ensure, in the case of a client
 // transport reconnect when an existing transport has not yet disconnected,
 // that ClientDisconnected is called first -- so it doesn't undo the new
 // ClientConnected. (psiphond meets these constraints by closing any
@@ -625,7 +625,7 @@ func (server *Server) runDeviceDownstream() {
 			continue
 		}
 
-		// destinationIPAddress determines which client recieves this packet.
+		// destinationIPAddress determines which client receives this packet.
 		// At this point, only enough of the packet is inspected to determine
 		// this routing info; further validation happens in subsequent
 		// processPacket in runClientDownstream.
@@ -830,9 +830,9 @@ func (server *Server) allocateIndex(newSession *session) error {
 		//   the network identifier (10.0.0.0) and broadcast
 		//   address (10.255.255.255) respectively
 		// - 1 is reserved as the server tun device address,
-		//   (10.0.0.1, and IPv6 equivilent)
+		//   (10.0.0.1, and IPv6 equivalent)
 		// - 2 is reserver as the transparent DNS target
-		//   address (10.0.0.2, and IPv6 equivilent)
+		//   address (10.0.0.2, and IPv6 equivalent)
 
 		if index <= 2 {
 			continue
@@ -842,7 +842,7 @@ func (server *Server) allocateIndex(newSession *session) error {
 			continue
 		}
 		if s, ok := server.indexToSession.LoadOrStore(index, newSession); ok {
-			// Index is already in use or aquired concurrently.
+			// Index is already in use or acquired concurrently.
 			// If the existing session is expired, reap it and use index.
 			existingSession := s.(*session)
 			if existingSession.expired(idleExpiry) {
@@ -1037,7 +1037,7 @@ func (metrics *packetMetrics) relayedPacket(
 	// - For port forwards, OSL progress tracking involves one SeedSpecs subnets
 	//   lookup per port forward; this may be too much overhead per packet; OSL
 	//   progress tracking also uses port forward duration as an input.
-	// - Can we do simple flow tracking to achive the same (a) lookup rate,
+	// - Can we do simple flow tracking to achieve the same (a) lookup rate,
 	//   (b) duration measurement? E.g., track flow via 4-tuple of source/dest
 	//   IP/port?
 
@@ -1683,8 +1683,6 @@ func getPacketDestinationIPAddress(
 
 		return packet[24:40], true
 	}
-
-	return nil, false
 }
 
 func processPacket(

+ 2 - 2
psiphon/common/tun/tun_linux.go

@@ -134,7 +134,7 @@ func configureNetworkConfigSubprocessCapabilities() error {
 	// be child processes via ambient mechanism described here:
 	// https://github.com/torvalds/linux/commit/58319057b7847667f0c9585b9de0e8932b0fdb08
 	//
-	// The ambient mechanim is available in Linux kernel 4.3 and later.
+	// The ambient mechanism is available in Linux kernel 4.3 and later.
 
 	// When using capabilities, this process should have CAP_NET_ADMIN in order
 	// to create tun devices. And the subprocess operations such as using "ifconfig"
@@ -344,7 +344,7 @@ func configureClientInterface(
 	// Set routing. Routes set here should automatically
 	// drop when the tun device is removed.
 
-	// TODO: appear to need explict routing only for IPv6?
+	// TODO: appear to need explicit routing only for IPv6?
 
 	for _, destination := range config.RouteDestinations {