Added new UDPBind interface

This commit is contained in:
Mathias Hall-Andersen
2017-10-08 22:03:32 +02:00
parent 2d856045a0
commit a72b0f7ae5
6 changed files with 236 additions and 214 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/base64"
"errors"
"fmt"
"net"
"sync"
"time"
)
@@ -15,8 +14,8 @@ type Peer struct {
persistentKeepaliveInterval uint64
keyPairs KeyPairs
handshake Handshake
endpoint Endpoint
device *Device
endpoint *net.UDPAddr
stats struct {
txBytes uint64 // bytes send to peer (endpoint)
rxBytes uint64 // bytes received from peer
@@ -134,7 +133,7 @@ func (peer *Peer) String() string {
return fmt.Sprintf(
"peer(%d %s %s)",
peer.id,
peer.endpoint.String(),
peer.endpoint.DestinationToString(),
base64.StdEncoding.EncodeToString(peer.handshake.remoteStatic[:]),
)
}