X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fcmd%2Fgovpn-client%2Fudp.go;h=abbbf070da86565e7a2af690b19e3e1ce9b8e6bd;hb=3413874a359d386b082614637c9ab247bb6510b4;hp=1b3396454be9172ef3988dd72fc7bf84131a671f;hpb=649e55e1ead338121ea76d6ae1187617ea9839d6;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-client/udp.go b/src/cypherpunks.ru/govpn/cmd/govpn-client/udp.go index 1b33964..abbbf07 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-client/udp.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-client/udp.go @@ -36,7 +36,7 @@ func startUDP(timeouted, rehandshaking, termination chan struct{}) { if err != nil { log.Fatalln("Can not listen on UDP:", err) } - govpn.Println("Connected to UDP:" + *remoteAddr) + govpn.Printf(`[connected remote="%s"]`, *remoteAddr) hs := govpn.HandshakeStart(*remoteAddr, conn, conf) buf := make([]byte, *mtu*2) @@ -55,7 +55,7 @@ MainCycle: conn.SetReadDeadline(time.Now().Add(time.Second)) n, err = conn.Read(buf) if timeouts == timeout { - govpn.Println("Timeouted") + govpn.Printf(`[connection-timeouted remote="%s"]`, *remoteAddr) timeouted <- struct{}{} break } @@ -67,18 +67,18 @@ MainCycle: if peer.PktProcess(buf[:n], tap, true) { timeouts = 0 } else { - govpn.Println("Unauthenticated packet") + govpn.Printf(`[packet-unauthenticated remote="%s"]`, *remoteAddr) timeouts++ } if atomic.LoadUint64(&peer.BytesIn)+atomic.LoadUint64(&peer.BytesOut) > govpn.MaxBytesPerKey { - govpn.Println("Need rehandshake") + govpn.Printf(`[rehandshake-required remote="%s"]`, *remoteAddr) rehandshaking <- struct{}{} break MainCycle } continue } if idsCache.Find(buf[:n]) == nil { - govpn.Println("Invalid identity in handshake packet") + govpn.Printf(`[identity-invalid remote="%s"]`, *remoteAddr) continue } timeouts = 0 @@ -86,7 +86,7 @@ MainCycle: if peer == nil { continue } - govpn.Println("Handshake completed") + govpn.Printf(`[handshake-completed remote="%s"]`, *remoteAddr) knownPeers = govpn.KnownPeers(map[string]**govpn.Peer{*remoteAddr: &peer}) if firstUpCall { go govpn.ScriptCall(*upPath, *ifaceName, *remoteAddr)