return true
}
-type WriteToer interface {
- WriteTo([]byte, net.Addr) (int, error)
+type WriteToUDPer interface {
+ WriteToUDP([]byte, *net.UDPAddr) (int, error)
}
// Process incoming Ethernet packet.
// ready channel is TAPListen's synchronization channel used to tell him
// that he is free to receive new packets. Encrypted and authenticated
// packets will be sent to remote Peer side immediately.
-func (p *Peer) EthProcess(ethPkt []byte, conn WriteToer, ready chan struct{}) {
+func (p *Peer) EthProcess(ethPkt []byte, conn WriteToUDPer, ready chan struct{}) {
now := time.Now()
size := len(ethPkt)
// If this heartbeat is necessary
}
}
p.LastSent = now
- if _, err := conn.WriteTo(append(p.frame, p.tag[:]...), p.Addr); err != nil {
+ if _, err := conn.WriteToUDP(append(p.frame, p.tag[:]...), p.Addr); err != nil {
log.Println("Error sending UDP", err)
}
}
type Dummy struct{}
-func (d *Dummy) WriteTo(b []byte, addr net.Addr) (int, error) {
+func (d *Dummy) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error) {
ciphertext = b
return len(b), nil
}