]> Cypherpunks.ru repositories - govpn.git/commitdiff
Language mistakes and stylistic fixes
authorSergey Matveev <stargrave@stargrave.org>
Fri, 3 Mar 2017 21:35:51 +0000 (00:35 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 3 Mar 2017 21:37:32 +0000 (00:37 +0300)
19 files changed:
src/cypherpunks.ru/govpn/client/client.go
src/cypherpunks.ru/govpn/client/tcp.go
src/cypherpunks.ru/govpn/client/udp.go
src/cypherpunks.ru/govpn/cmd/govpn-client/main.go
src/cypherpunks.ru/govpn/cmd/govpn-server/action.go
src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go
src/cypherpunks.ru/govpn/cmd/govpn-server/main.go
src/cypherpunks.ru/govpn/common.go
src/cypherpunks.ru/govpn/identity.go
src/cypherpunks.ru/govpn/peer.go
src/cypherpunks.ru/govpn/server/common.go
src/cypherpunks.ru/govpn/server/server.go
src/cypherpunks.ru/govpn/server/tcp.go
src/cypherpunks.ru/govpn/server/udp.go
src/cypherpunks.ru/govpn/stats.go
src/cypherpunks.ru/govpn/tap.go
src/cypherpunks.ru/govpn/tap_android.go
src/cypherpunks.ru/govpn/tap_darwin.go
src/cypherpunks.ru/govpn/tap_linux.go

index ef832af8fbc5c55f3a8f460b369a0d69b0c90446..9327ec77044eb4e9d3119e06a92266da292fb8fa 100644 (file)
@@ -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")
        }
index 0832e11b17148ed7ae311e0b1ad30a30bcc26a9f..0b7bbe6cf763c86f439da7ac5fb891686c3255a4 100644 (file)
@@ -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
                }
index a4bbcf756cb8aca8e72576f0fa50100dfa0039fc..e99238950daaefb0d1ab878f6ca28fc58421ad33 100644 (file)
@@ -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
index a3399ab8ead7921e830c021697b294f3ac4c8453..7a247732c89fb72e2b977ba75358d5a87491b431 100644 (file)
@@ -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 != "" {
index 751081a83c97232448d9c1fb79a6ffa78fedfe92..59ab81dc0c60a951ccbc72ad6ce1dd4a379e61d3 100644 (file)
@@ -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)
index d357b2536c9d25158943a2f363b0113761a27ba6..f950ec886aa057249d26c713bf7b4c24400c555d 100644 (file)
@@ -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")
                        }
                }
        }()
index a60e5a01cd38251818b0ec2b6d455c78a06b8402..111c87021cf1f56d4fe9317e453a370fb2f4737e 100644 (file)
@@ -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)
 
index 72873d05f17e716f4064315979dcf7b6ce475727..b6c1d3fe9c3cdd3eeef21155100cf8670d9ddd37 100644 (file)
@@ -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")
        }
 }
index db338f0348c98b9e5593c17872664e663e9eda17..fcab8ab8cd682c34ab7a8e3ad2d2ed7403288e66 100644 (file)
@@ -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
 }
index 900aeb9d47ff22b965b384da2c95cf8399f53727..53539e8fac2b9d43fc441af510bc40ab732425bb 100644 (file)
@@ -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)
index 9a5554bda2d0429906edb456ab04069635e4b93d..51e219fd4f375edbbcfd40e29ca331547c53ba7f 100644 (file)
@@ -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,
index ef53b8f626e25e79a3ba292dab75f0175808e7e2..4aa501389e03de025723c722f707e169d8437c3c 100644 (file)
@@ -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{}{}
                                }
index 59eda53cb72b4bd3c16ccd7ff542312e342b0787..472c74b06c20e88957f906483c627382f7316294 100644 (file)
@@ -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
index 32fde7d11e1f7f7dad2ec2c4a51acefa154cb89e..c8cb72f680ed982fc31a217faf64bf6a0c7adcf1 100644 (file)
@@ -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(
index 2f6c5170f7654047c5011790d682c399f3457c37..91cbf5dfb20c2a9ad7cfb933cae5350d4de8490d 100644 (file)
@@ -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")
                }
        }
 }
index 624f8d566343e4491673285378eca3414789d48d..efb53a3e591c95dacf1f90057a9d065a63292ac4 100644 (file)
@@ -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
index 292c17c5043bebbcc2219711758147181c4d6529..15c5940f7648819eeffb8e1c6bdaee1123e182b2 100644 (file)
@@ -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
index 766597cf8f25ffba1d183cfac097da4fb1bb8f32..8f0247ca3f638dea25b89558746e4d5bed6a8dfb 100644 (file)
@@ -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")
index ee95ae699360bc491ab729caec1b9c51956c3041..a72c62615166bc5a522731ff051d6f351c4cf969 100644 (file)
@@ -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) {