From: Sergey Matveev Date: Fri, 3 Mar 2017 21:35:51 +0000 (+0300) Subject: Language mistakes and stylistic fixes X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=commitdiff_plain;h=f74b9372fd8ec1d040fc2ebb29ee60077b3e1efc Language mistakes and stylistic fixes --- diff --git a/src/cypherpunks.ru/govpn/client/client.go b/src/cypherpunks.ru/govpn/client/client.go index ef832af..9327ec7 100644 --- a/src/cypherpunks.ru/govpn/client/client.go +++ b/src/cypherpunks.ru/govpn/client/client.go @@ -164,7 +164,7 @@ func (c *Client) MainCycle() { c.LogFields(), ).WithFields( c.config.LogFields(), - ).Info("Starting...") + ).Info("Starting") // if available, run PreUp, it might create interface if c.config.Peer.PreUp != nil { @@ -184,7 +184,7 @@ func (c *Client) MainCycle() { // if TAP wasn't set by PreUp, listen here if c.tap == nil { - l.WithField("asking", c.config.Peer.Iface).Debug("No interface, try to listen") + l.WithField("asking", c.config.Peer.Iface).Debug("No interface, trying to listen") c.tap, err = govpn.TAPListen(c.config.Peer.Iface, c.config.Peer.MTU) if err != nil { c.Error <- errors.Wrapf( @@ -196,7 +196,7 @@ func (c *Client) MainCycle() { } } c.config.Peer.Iface = c.tap.Name - l.WithFields(c.LogFields()).Debug("Got interface, start main loop") + l.WithFields(c.LogFields()).Debug("Got interface, starting main loop") MainCycle: for { @@ -205,10 +205,10 @@ MainCycle: c.termination = make(chan struct{}) switch c.config.Protocol { case govpn.ProtocolUDP: - l.Debug("Start UDP") + l.Debug("Starting UDP") go c.startUDP() case govpn.ProtocolTCP: - l.Debug("Start TCP") + l.Debug("Starting TCP") if c.config.isProxy() { go c.proxyTCP() } else { @@ -236,7 +236,7 @@ MainCycle: close(c.rehandshaking) close(c.termination) } - l.WithFields(c.config.LogFields()).Debug("Run post down action") + l.WithFields(c.config.LogFields()).Debug("Running post down action") if err = c.postDownAction(); err != nil { c.Error <- errors.Wrap(err, "c.postDownAction") } diff --git a/src/cypherpunks.ru/govpn/client/tcp.go b/src/cypherpunks.ru/govpn/client/tcp.go index 0832e11..0b7bbe6 100644 --- a/src/cypherpunks.ru/govpn/client/tcp.go +++ b/src/cypherpunks.ru/govpn/client/tcp.go @@ -37,7 +37,7 @@ func (c *Client) startTCP() { l := c.logger.WithField("func", logFuncPrefix+"Client.startTCP") // initialize using a file descriptor if c.config.FileDescriptor > 0 { - l.WithField("fd", c.config.FileDescriptor).Debug("Connect using file descriptor") + l.WithField("fd", c.config.FileDescriptor).Debug("Connecting using file descriptor") var err error conn, err = net.FileConn(os.NewFile( uintptr(c.config.FileDescriptor), @@ -49,7 +49,7 @@ func (c *Client) startTCP() { } } else { // TODO move resolution into the loop, as the name might change over time - l.WithField("fd", c.config.RemoteAddress).Debug("Connect using TCP") + l.WithField("fd", c.config.RemoteAddress).Debug("Connecting using TCP") remote, err := net.ResolveTCPAddr("tcp", c.config.RemoteAddress) if err != nil { c.Error <- errors.Wrapf(err, "net.ResolveTCPAdd %s", c.config.RemoteAddress) @@ -119,7 +119,7 @@ HandshakeCycle: fields, ).WithFields( c.LogFields(), - ).WithError(err).Debug("Can't find peer in ids") + ).WithError(err).Debug("Can not find peer in ids") continue } peer, err = hs.Client(buf[:prev]) @@ -131,7 +131,7 @@ HandshakeCycle: err, ).WithFields( c.LogFields(), - ).Debug("Can't create new peer") + ).Debug("Can not create new peer") continue } c.logger.WithFields(fields).WithFields(c.LogFields()).Info("Handshake completed") @@ -165,9 +165,7 @@ TransportCycle: default: } if prev == len(buf) { - c.logger.WithFields( - c.LogFields(), - ).Debug("Packet timeouted") + c.logger.WithFields(c.LogFields()).Debug("Packet timeouted") c.timeouted <- struct{}{} break TransportCycle } diff --git a/src/cypherpunks.ru/govpn/client/udp.go b/src/cypherpunks.ru/govpn/client/udp.go index a4bbcf7..e992389 100644 --- a/src/cypherpunks.ru/govpn/client/udp.go +++ b/src/cypherpunks.ru/govpn/client/udp.go @@ -32,7 +32,7 @@ func (c *Client) startUDP() { l := c.logger.WithField("func", "startUDP") // TODO move resolution into the loop, as the name might change over time - l.Debug("Resolve UDP address") + l.Debug("Resolving UDP address") remote, err := net.ResolveUDPAddr("udp", c.config.RemoteAddress) if err != nil { c.Error <- errors.Wrapf(err, "net.ResolveUDPAddr %s", c.config.RemoteAddress) @@ -46,14 +46,14 @@ func (c *Client) startUDP() { } l.WithFields(c.config.LogFields()).Info("Connected") - l.Debug("Handshake start") + l.Debug("Handshake starting") hs, err := govpn.HandshakeStart(c.config.RemoteAddress, conn, c.config.Peer) if err != nil { govpn.CloseLog(conn, c.logger, c.LogFields()) c.Error <- errors.Wrap(err, "govpn.HandshakeStart") return } - l.Debug("Handshake done") + l.Debug("Handshake completed") buf := make([]byte, c.config.Peer.MTU*2) var n int @@ -85,12 +85,12 @@ MainCycle: break } if err != nil { - l.WithError(err).WithFields(c.LogFields()).Debug("Can't read from connection") + l.WithError(err).WithFields(c.LogFields()).Debug("Can not read from connection") timeouts++ continue } if peer != nil { - c.logger.WithFields(c.LogFields()).Debug("No peer yet, process packet") + c.logger.WithFields(c.LogFields()).Debug("No peer yet, processing packet") if peer.PktProcess(buf[:n], c.tap, true) { l.WithFields(c.LogFields()).Debug("Packet processed") timeouts = 0 diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go b/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go index a3399ab..7a24773 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go @@ -71,7 +71,7 @@ func main() { logger, err := govpn.NewLogger(*logLevel, *syslog) if err != nil { - logrus.WithFields(fields).WithError(err).Fatal("Can't initialize logging") + logrus.WithFields(fields).WithError(err).Fatal("Can not initialize logging") } if *egdPath != "" { @@ -109,7 +109,7 @@ func main() { } priv, err := verifier.PasswordApply(key) if err != nil { - logger.WithError(err).Fatal("Can't PasswordApply") + logger.WithError(err).Fatal("Can not PasswordApply") } if *encless { if protocol != govpn.ProtocolTCP { @@ -145,7 +145,7 @@ func main() { c, err := client.NewClient(conf, logger, govpn.CatchSignalShutdown()) if err != nil { - logger.WithError(err).Fatal("Can't initialize client") + logger.WithError(err).Fatal("Can not initialize client") } if *stats != "" { diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-server/action.go b/src/cypherpunks.ru/govpn/cmd/govpn-server/action.go index 751081a..59ab81d 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-server/action.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-server/action.go @@ -46,7 +46,7 @@ func preUpAction(path string) govpn.TunnelPreUpAction { } if len(ctx.Config.Iface) == 0 { - return nil, errors.Errorf("Script %q didn't returned an interface name", path) + return nil, errors.Errorf("Script %q didn't return interface name", path) } tap, err := govpn.TAPListen(ctx.Config.Iface, ctx.Config.MTU) diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go b/src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go index d357b25..f950ec8 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go @@ -119,7 +119,7 @@ func confRefresh() error { fields := logrus.Fields{ "func": "confRefresh", } - logger.WithFields(fields).Debug("Check configuration file") + logger.WithFields(fields).Debug("Checking configuration file") newConfs, err := confRead() if err != nil { return errors.Wrap(err, "confRead") @@ -145,7 +145,7 @@ func confInit() { if err != nil { logger.WithError(err).WithFields( fields, - ).Fatal("Couldn't perform initial configuration read") + ).Fatal("Can not perform initial configuration read") } go func() { for { @@ -153,7 +153,7 @@ func confInit() { if err = confRefresh(); err != nil { logger.WithError(err).WithFields( fields, - ).Error("Couldn't refresh configuration") + ).Error("Can not refresh configuration") } } }() diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go b/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go index a60e5a0..111c870 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-server/main.go @@ -60,7 +60,7 @@ func main() { if err != nil { logrus.WithFields( fields, - ).WithError(err).Fatal("Couldn't initialize logging") + ).WithError(err).Fatal("Can not initialize logging") } govpn.SetLogger(logger) diff --git a/src/cypherpunks.ru/govpn/common.go b/src/cypherpunks.ru/govpn/common.go index 72873d0..b6c1d3f 100644 --- a/src/cypherpunks.ru/govpn/common.go +++ b/src/cypherpunks.ru/govpn/common.go @@ -91,7 +91,7 @@ func (p *Protocol) UnmarshalJSON(encoded []byte) error { if err := json.Unmarshal(encoded, &str); err != nil { return errors.Wrapf( err, - "Can't unmarshall to string %q", + "Can not unmarshall to string %q", hex.EncodeToString(encoded), ) } @@ -166,7 +166,7 @@ func CatchSignalShutdown() chan interface{} { logger.WithFields(logrus.Fields{ "func": logFuncPrefix + "CatchSignalShutdown", "signal": sig.String(), - }).Debug("Catch signal, shutting down") + }).Debug("Catched signal, shutting down") shutdownChan <- sig }() return shutdownChan @@ -181,6 +181,6 @@ func SetLogger(l *logrus.Logger) { // CloseLog log an error if a io.Closer fail to Close func CloseLog(c io.Closer, l *logrus.Logger, fields logrus.Fields) { if err := c.Close(); err != nil { - logrus.WithFields(fields).WithError(err).Error("Can't close connection") + logrus.WithFields(fields).WithError(err).Error("Can not close connection") } } diff --git a/src/cypherpunks.ru/govpn/identity.go b/src/cypherpunks.ru/govpn/identity.go index db338f0..fcab8ab 100644 --- a/src/cypherpunks.ru/govpn/identity.go +++ b/src/cypherpunks.ru/govpn/identity.go @@ -79,7 +79,7 @@ func (mc *MACCache) Update(peers *map[PeerID]*PeerConf) error { "func": logFuncPrefix + "MACCache.Update", "peers": len(*peers), } - logger.WithFields(fields).WithField("size", mc.Length()).Debug("Clean old keys") + logger.WithFields(fields).WithField("size", mc.Length()).Debug("Cleaning old keys") for pid := range mc.cache { if _, exists := (*peers)[pid]; !exists { logger.WithFields(fields).WithField("pid", pid).Debug("Cleaning key") @@ -91,7 +91,7 @@ func (mc *MACCache) Update(peers *map[PeerID]*PeerConf) error { ).WithField( "size", mc.Length(), - ).Debug("Cleaned, add/update new key") + ).Debug("Cleaned, adding/updating new keys") for pid, pc := range *peers { if _, exists := mc.cache[pid]; exists { logger.WithFields(fields).WithFields( @@ -118,7 +118,7 @@ func (mc *MACCache) Update(peers *map[PeerID]*PeerConf) error { } } } - logger.WithFields(fields).WithField("size", mc.Length()).Debug("Finish") + logger.WithFields(fields).WithField("size", mc.Length()).Debug("Finished") return nil } @@ -158,7 +158,7 @@ func (mc *MACCache) Find(data []byte) (*PeerID, error) { } logger.WithFields(fields).Debug("Starting") if len(data) < minimumSize { - return nil, errors.Errorf("MAC is too small %d, minimum %d", len(data), minimumSize) + return nil, errors.Errorf("MAC is too short %d, minimum %d", len(data), minimumSize) } buf := make([]byte, 8) sum := make([]byte, 32) @@ -166,12 +166,16 @@ func (mc *MACCache) Find(data []byte) (*PeerID, error) { defer mc.l.RUnlock() for pid, mt := range mc.cache { loopFields := logrus.Fields{"pid": pid.String()} - logger.WithFields(loopFields).Debug("process") + logger.WithFields(loopFields).Debug("Processing") copy(buf, data) AddTimeSync(mt.ts, buf) mt.l.Lock() mt.mac.Reset() - logger.WithFields(fields).WithField("buf", hex.EncodeToString(buf)).Debug("mt.mac.Write") + logger.WithFields( + fields, + ).WithField( + "buf", hex.EncodeToString(buf), + ).Debug("mt.mac.Write") if _, err := mt.mac.Write(buf); err != nil { mt.l.Unlock() return nil, errors.Wrap(err, "mt.mac.Write") @@ -191,8 +195,8 @@ func (mc *MACCache) Find(data []byte) (*PeerID, error) { return &ppid, nil } - logger.WithFields(fields).WithFields(loopFields).Debug("Not matching peer") + logger.WithFields(fields).WithFields(loopFields).Debug("Peer is not matched") } - logger.WithFields(fields).Debug("Can't find matching peer ID") + logger.WithFields(fields).Debug("Can not find matching peer ID") return nil, nil } diff --git a/src/cypherpunks.ru/govpn/peer.go b/src/cypherpunks.ru/govpn/peer.go index 900aeb9..53539e8 100644 --- a/src/cypherpunks.ru/govpn/peer.go +++ b/src/cypherpunks.ru/govpn/peer.go @@ -372,7 +372,7 @@ func (p *Peer) PktProcess(data []byte, tap io.Writer, reorderable bool) bool { ).WithField( "minimum_packet_Length", MinPktLength, - ).Debug("Ignore packet smaller than allowed minimum") + ).Debug("Ignoring packet smaller than allowed minimum") return false } if !p.Encless && len(data) > len(p.bufR)-CC20IBS { @@ -471,7 +471,7 @@ func (p *Peer) PktProcess(data []byte, tap io.Writer, reorderable bool) bool { } p.BytesPayloadIn += uint64(p.pktSizeR) if _, err = tap.Write(out[:p.pktSizeR]); err != nil { - logger.WithFields(p.LogFields()).WithFields(fields).WithError(err).Error("Can't write to TAP") + logger.WithFields(p.LogFields()).WithFields(fields).WithError(err).Error("Can not write to TAP") } return true } @@ -502,7 +502,7 @@ func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) { ).WithFields( peer.LogFields(), ).WithError(err).Warn( - "Can't process nil ethernet packet", + "Can not process nil Ethernet packet", ) } lastSent = now @@ -513,7 +513,7 @@ func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) { fields, ).WithFields( peer.LogFields(), - ).WithError(err).Warn("Can't process ethernet packet") + ).WithError(err).Warn("Can not process Ethernet packet") } lastSent = time.Now() } @@ -531,7 +531,7 @@ func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) { fields, ).WithFields( peer.LogFields(), - ).WithError(err).Warn("Can't process ethernet packet") + ).WithError(err).Warn("Can not process Ethernet packet") } default: } @@ -541,7 +541,7 @@ func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) { fields, ).WithFields( peer.LogFields(), - ).WithError(err).Warn("Can't process nil ethernet packet") + ).WithError(err).Warn("Can not process nil Ethernet packet") } } time.Sleep(peer.CPRCycle) diff --git a/src/cypherpunks.ru/govpn/server/common.go b/src/cypherpunks.ru/govpn/server/common.go index 9a5554b..51e219f 100644 --- a/src/cypherpunks.ru/govpn/server/common.go +++ b/src/cypherpunks.ru/govpn/server/common.go @@ -27,8 +27,8 @@ import ( const logFuncPrefix = "govpn/server." var ( - errMisconfiguredTap = errors.New("No PreUp and no Iface, can't create interface") - errPreUpNoTap = errors.New("PreUp didn't returned an interface, and Iface is unset") + errMisconfiguredTap = errors.New("No PreUp and no Iface, can not create interface") + errPreUpNoTap = errors.New("PreUp didn't return interface, and Iface is unset") ) func (s *Server) callUp(peer *govpn.Peer, proto govpn.Protocol) (*govpn.TAP, error) { @@ -51,7 +51,7 @@ func (s *Server) callUp(peer *govpn.Peer, proto govpn.Protocol) (*govpn.TAP, err } if conf.PreUp != nil { - s.logger.WithFields(fields).Debug("PreUp defined, execute it") + s.logger.WithFields(fields).Debug("PreUp defined, executing it") tap, err = conf.PreUp(govpn.PeerContext{ RemoteAddress: peer.Addr, Protocol: proto, @@ -62,11 +62,11 @@ func (s *Server) callUp(peer *govpn.Peer, proto govpn.Protocol) (*govpn.TAP, err } s.logger.WithFields(fields).WithField("tap", tap).Debug("PreUp finished") } else { - s.logger.WithFields(fields).Debug("No PreUp defined, skip") + s.logger.WithFields(fields).Debug("No PreUp defined, skipping") } if tap == nil { - s.logger.WithFields(fields).Debug("PreUp didn't returned an interface, create one") + s.logger.WithFields(fields).Debug("PreUp did not return interface, creating one") if !isConfigIface { return nil, errors.Wrapf(errPreUpNoTap, "interface:%q tap:%q", conf.Iface, tap) } @@ -82,7 +82,7 @@ func (s *Server) callUp(peer *govpn.Peer, proto govpn.Protocol) (*govpn.TAP, err s.logger.WithFields(fields).Debug("Got interface, no Up") return tap, nil } - s.logger.WithFields(fields).Debug("Got interface, execute Up") + s.logger.WithFields(fields).Debug("Got interface, executing Up") err = conf.Up(govpn.PeerContext{ RemoteAddress: peer.Addr, @@ -102,14 +102,14 @@ func (s *Server) callDown(ps *PeerState) error { conf := s.confs.Get(*ps.peer.ID) if conf == nil { - s.logger.WithFields(fields).Error("Couldn't get configuration") + s.logger.WithFields(fields).Error("Can not get configuration") return nil } if conf.Down == nil { - s.logger.WithFields(fields).Debug("No Down, skip") + s.logger.WithFields(fields).Debug("No Down, skipping") return nil } - s.logger.WithFields(fields).Debug("Execute Down") + s.logger.WithFields(fields).Debug("Executing Down") err := conf.Down(govpn.PeerContext{ RemoteAddress: ps.peer.Addr, Config: *conf, diff --git a/src/cypherpunks.ru/govpn/server/server.go b/src/cypherpunks.ru/govpn/server/server.go index ef53b8f..4aa5013 100644 --- a/src/cypherpunks.ru/govpn/server/server.go +++ b/src/cypherpunks.ru/govpn/server/server.go @@ -163,7 +163,7 @@ func (s *Server) MainCycle() { s.LogFields(), ).WithFields( s.configuration.LogFields(), - ).Info("Starting...") + ).Info("Starting") var needsDeletion bool var err error @@ -194,7 +194,7 @@ MainCycle: fields, ).WithFields( ps.peer.LogFields(), - ).Error("Couldn't close TAP") + ).Error("Can not close TAP") } } // empty value signals that everything is fine @@ -210,7 +210,7 @@ MainCycle: fields, ).WithFields( hs.LogFields(), - ).Debug("handshake is expired, delete") + ).Debug("Handshake is expired, deleting") hs.Zero() delete(s.handshakes, addr) } @@ -238,14 +238,14 @@ MainCycle: fields, ).WithFields( ps.peer.LogFields(), - ).Error("Couldn't execute callDown") + ).Error("Can not execute callDown") } if err = ps.tap.Close(); err != nil { logrus.WithError(err).WithFields( fields, ).WithFields( ps.peer.LogFields(), - ).Error("Couldn't close TAP") + ).Error("Can not close TAP") } ps.terminator <- struct{}{} } diff --git a/src/cypherpunks.ru/govpn/server/tcp.go b/src/cypherpunks.ru/govpn/server/tcp.go index 59eda53..472c74b 100644 --- a/src/cypherpunks.ru/govpn/server/tcp.go +++ b/src/cypherpunks.ru/govpn/server/tcp.go @@ -102,7 +102,7 @@ func (s *Server) handleTCP(conn net.Conn) { s.LogFields(), ).WithError( err, - ).Debug("Can't read connection: either EOFed or timeouted") + ).Debug("Can not read connection: either EOFed or timeouted") break } prev += n @@ -112,11 +112,15 @@ func (s *Server) handleTCP(conn net.Conn) { fields, ).WithFields( s.LogFields(), - ).WithError(err).Debug("Couldn't lookup for peer in ids") + ).WithError(err).Debug("Can not lookup for peer in ids") continue } if peerID == nil { - s.logger.WithFields(fields).WithFields(s.LogFields()).Debug("Couldn't find peer") + s.logger.WithFields( + fields, + ).WithFields( + s.LogFields(), + ).Debug("Can not find peer") continue } if hs == nil { @@ -139,7 +143,7 @@ func (s *Server) handleTCP(conn net.Conn) { fields, ).WithError(err).WithFields( s.LogFields(), - ).Error("Can't create new peer") + ).Error("Can not create new peer") continue } prev = 0 @@ -253,7 +257,7 @@ func (s *Server) handleTCP(conn net.Conn) { s.LogFields(), ).WithError( err, - ).Debug("Can't read connection: either EOFed or timeouted") + ).Debug("Can not read connection: either EOFed or timeouted") break } prev += n diff --git a/src/cypherpunks.ru/govpn/server/udp.go b/src/cypherpunks.ru/govpn/server/udp.go index 32fde7d..c8cb72f 100644 --- a/src/cypherpunks.ru/govpn/server/udp.go +++ b/src/cypherpunks.ru/govpn/server/udp.go @@ -75,7 +75,7 @@ func (s *Server) startUDP() { var peerID *govpn.PeerID var conf *govpn.PeerConf for { - s.logger.WithFields(fields).Debug("Wait for UDP buffer") + s.logger.WithFields(fields).Debug("Waiting for UDP buffer") buf = <-udpBufs n, raddr, err = conn.ReadFromUDP(buf) if err != nil { @@ -83,7 +83,7 @@ func (s *Server) startUDP() { fields, ).WithFields( s.LogFields(), - ).WithError(err).Debug("Receive failure") + ).WithError(err).Debug("Receive failed") break } addr = raddr.String() @@ -93,7 +93,7 @@ func (s *Server) startUDP() { fields, ).WithFields( loopFields, - ).Debug("Got UDP buffer, check if peer exists") + ).Debug("Got UDP buffer, checking if peer exists") s.peersLock.RLock() ps, exists = s.peers[addr] s.peersLock.RUnlock() @@ -119,7 +119,7 @@ func (s *Server) startUDP() { fields, ).WithFields( loopFields, - ).Debug("No handshake yet, try to figure peer ID") + ).Debug("No handshake yet, trying to figure peer ID") peerID, err = s.idsCache.Find(buf[:n]) if err != nil { s.logger.WithFields( @@ -128,7 +128,7 @@ func (s *Server) startUDP() { loopFields, ).WithFields( s.LogFields(), - ).WithError(err).Debug("Couldn't lookup for peer in ids") + ).WithError(err).Debug("Can not lookup for peer in ids") udpBufs <- buf continue } @@ -145,7 +145,7 @@ func (s *Server) startUDP() { } loopFields["peer_id"] = peerID.String() - s.logger.WithFields(fields).WithFields(loopFields).Debug("Found peer ID") + s.logger.WithFields(fields).WithFields(loopFields).Debug("Peer ID found") conf = s.confs.Get(*peerID) if conf == nil { s.logger.WithFields( @@ -165,7 +165,7 @@ func (s *Server) startUDP() { loopFields, ).WithFields( fields, - ).Debug("Got configuration, perform handshake") + ).Debug("Got configuration, performing handshake") hs = govpn.NewHandshake( addr, udpSender{conn: conn, addr: raddr}, @@ -180,7 +180,7 @@ func (s *Server) startUDP() { fields, ).WithError(err).WithFields( s.LogFields(), - ).Error("Can't create new peer: handshake failed") + ).Error("Can not create new peer: handshake failed") continue } s.logger.WithFields( @@ -189,7 +189,7 @@ func (s *Server) startUDP() { fields, ).WithFields( s.LogFields(), - ).Info("Hashshake started, continue next packet") + ).Info("Hashshake started, continuing for the next packet") s.hsLock.Lock() s.handshakes[addr] = hs @@ -201,7 +201,7 @@ func (s *Server) startUDP() { fields, ).WithFields( loopFields, - ).Debug("Already go handshake, finish it") + ).Debug("Already got handshake, finishing it") peer, err := hs.Server(buf[:n]) if err != nil { s.logger.WithFields( @@ -210,7 +210,7 @@ func (s *Server) startUDP() { loopFields, ).WithError(err).WithFields( s.LogFields(), - ).Error("Can't create new peer: handshake failed") + ).Error("Can not create new peer: handshake failed") udpBufs <- buf continue } @@ -221,7 +221,7 @@ func (s *Server) startUDP() { loopFields, ).WithFields( s.LogFields(), - ).Error("Couldn't continue handshake") + ).Error("Can not continue handshake") udpBufs <- buf continue } @@ -296,7 +296,7 @@ func (s *Server) startUDP() { fields, ).WithFields( loopFields, - ).Debug("Peer do not already exists") + ).Debug("Peer does not exist") tap, err := s.callUp(peer, govpn.ProtocolUDP) if err != nil { s.logger.WithFields( diff --git a/src/cypherpunks.ru/govpn/stats.go b/src/cypherpunks.ru/govpn/stats.go index 2f6c517..91cbf5d 100644 --- a/src/cypherpunks.ru/govpn/stats.go +++ b/src/cypherpunks.ru/govpn/stats.go @@ -55,14 +55,14 @@ func StatsProcessor(stats string, peers *KnownPeers) { if err != nil { logger.WithError(err).WithField( "stats", stats, - ).Error("Can't listen stats server") + ).Error("Can not listen stats server") return } for { conn, err = statsPort.Accept() if err != nil { - logger.WithFields(fields).WithError(err).Error("Can't accept connection") + logger.WithFields(fields).WithError(err).Error("Can not accept connection") continue } deadLine := time.Now().Add(rwTimeout) @@ -72,11 +72,11 @@ func StatsProcessor(stats string, peers *KnownPeers) { ).WithField( "deadline", deadLine.String(), - ).WithError(err).Error("Can't set deadline") + ).WithError(err).Error("Can not set deadline") } else if _, err = conn.Read(buf); err != nil { - logger.WithFields(fields).WithError(err).Error("Can't read buffer") + logger.WithFields(fields).WithError(err).Error("Can not read buffer") } else if _, err = conn.Write([]byte("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\n\r\n")); err != nil { - logger.WithFields(fields).WithError(err).Error("Can't write HTTP headers") + logger.WithFields(fields).WithError(err).Error("Can not write HTTP headers") } else { var peersList []*Peer for _, peer := range *peers { @@ -87,11 +87,11 @@ func StatsProcessor(stats string, peers *KnownPeers) { fields, ).WithField( "peers", len(peersList), - ).WithError(err).Error("Can't encode to JSON") + ).WithError(err).Error("Can not encode to JSON") } } if err = conn.Close(); err != nil { - logger.WithFields(fields).WithError(err).Error("Can't close connection") + logger.WithFields(fields).WithError(err).Error("Can not close connection") } } } diff --git a/src/cypherpunks.ru/govpn/tap.go b/src/cypherpunks.ru/govpn/tap.go index 624f8d5..efb53a3 100644 --- a/src/cypherpunks.ru/govpn/tap.go +++ b/src/cypherpunks.ru/govpn/tap.go @@ -74,7 +74,7 @@ func NewTAP(ifaceName string, mtu int) (*TAP, error) { "func": logFuncPrefix + "TAP read sink loop", "name": tap.Name, "mtu": mtu, - }).Error("Can't read interface") + }).Error("Can not read interface") return // TODO: need a way to warn consumer that something is wrong // TODO: to force peer to just disconnect diff --git a/src/cypherpunks.ru/govpn/tap_android.go b/src/cypherpunks.ru/govpn/tap_android.go index 292c17c..15c5940 100644 --- a/src/cypherpunks.ru/govpn/tap_android.go +++ b/src/cypherpunks.ru/govpn/tap_android.go @@ -63,7 +63,7 @@ func TapListenFileDescriptor(fd uintptr, ifaceName string, mtu int) *TAP { "func", logFuncPrefix + "TUN read sink loop", "name": tap.Name, "mtu": mtu, - }).Error("Can't read interface, stop") + }).Error("Can not read interface, stop") return // TODO: need a way to warn consumer that something is wrong // TODO: to force peer to just disconnect diff --git a/src/cypherpunks.ru/govpn/tap_darwin.go b/src/cypherpunks.ru/govpn/tap_darwin.go index 766597c..8f0247c 100644 --- a/src/cypherpunks.ru/govpn/tap_darwin.go +++ b/src/cypherpunks.ru/govpn/tap_darwin.go @@ -31,7 +31,7 @@ func newTAPer(ifaceName *string) (io.ReadWriteCloser, error) { return nil, errors.Wrap(errUnsupportedInterface, *ifaceName) } if *ifaceName != interfaceTun { - return nil, errors.Errorf("Darwin don't allow to set an interface name, only %q is supported", *ifaceName) + return nil, errors.Errorf("Darwin does not allow to set an interface name, only %q is supported", *ifaceName) } output, err := water.New(water.Config{DeviceType: water.TUN}) return output, errors.Wrap(err, "water.New") diff --git a/src/cypherpunks.ru/govpn/tap_linux.go b/src/cypherpunks.ru/govpn/tap_linux.go index ee95ae6..a72c626 100644 --- a/src/cypherpunks.ru/govpn/tap_linux.go +++ b/src/cypherpunks.ru/govpn/tap_linux.go @@ -31,7 +31,7 @@ func newTAPer(ifaceName *string) (io.ReadWriteCloser, error) { config := water.Config{} if len(*ifaceName) == 0 { - return nil, errors.New("Can't figure interface type, empty name") + return nil, errors.New("Can not figure interface type, empty name") } if strings.HasPrefix(*ifaceName, interfaceTap) {