summaryrefslogtreecommitdiffhomepage
path: root/src/peer.go
diff options
context:
space:
mode:
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 {