summaryrefslogtreecommitdiffhomepage
path: root/src/peer.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-10-27 10:43:37 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-10-27 10:43:37 +0200
commit0485c34c8e20e4f7ea19bd3c3f52d2f4717caead (patch)
tree72c360fc84cb731bfa84fc627063debdf69ecd2c /src/peer.go
parentfd6f2e1f554cb545c7c554b56e2ac77308822680 (diff)
Fixed message header length in conn_linux
Diffstat (limited to 'src/peer.go')
-rw-r--r--src/peer.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/peer.go b/src/peer.go
index f24dcd8..a98fc97 100644
--- a/src/peer.go
+++ b/src/peer.go
@@ -138,6 +138,17 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) {
return peer, nil
}
+func (peer *Peer) SendBuffer(buffer []byte) error {
+ peer.device.net.mutex.RLock()
+ defer peer.device.net.mutex.RUnlock()
+ peer.mutex.RLock()
+ defer peer.mutex.RUnlock()
+ if !peer.endpoint.set {
+ return errors.New("No known endpoint for peer")
+ }
+ return peer.device.net.bind.Send(buffer, &peer.endpoint.value)
+}
+
/* Returns a short string identification for logging
*/
func (peer *Peer) String() string {