@@ -60,6 +60,8 @@ type maConn struct {
6060 raddr ma.Multiaddr
6161}
6262
63+ var _ Conn = (* maConn )(nil )
64+
6365// LocalMultiaddr returns the local address associated with
6466// this connection
6567func (c * maConn ) LocalMultiaddr () ma.Multiaddr {
@@ -251,14 +253,12 @@ func WrapNetListener(nl net.Listener) (Listener, error) {
251253// A PacketConn is a generic packet oriented network connection which uses an
252254// underlying net.PacketConn, wrapped with the locally bound Multiaddr.
253255type PacketConn interface {
254- Connection () net.PacketConn
255-
256- Multiaddr () ma.Multiaddr
256+ net.PacketConn
257257
258- ReadFrom (b []byte ) (int , ma.Multiaddr , error )
259- WriteTo (b []byte , maddr ma.Multiaddr ) (int , error )
258+ LocalMultiaddr () ma.Multiaddr
260259
261- Close () error
260+ ReadFromMultiaddr (b []byte ) (int , ma.Multiaddr , error )
261+ WriteToMultiaddr (b []byte , maddr ma.Multiaddr ) (int , error )
262262}
263263
264264// maPacketConn implements PacketConn
@@ -267,28 +267,25 @@ type maPacketConn struct {
267267 laddr ma.Multiaddr
268268}
269269
270- // Connection returns the embedded net.PacketConn.
271- func (l * maPacketConn ) Connection () net.PacketConn {
272- return l .PacketConn
273- }
270+ var _ PacketConn = (* maPacketConn )(nil )
274271
275- // Multiaddr returns the bound local Multiaddr.
276- func (l * maPacketConn ) Multiaddr () ma.Multiaddr {
272+ // LocalMultiaddr returns the bound local Multiaddr.
273+ func (l * maPacketConn ) LocalMultiaddr () ma.Multiaddr {
277274 return l .laddr
278275}
279276
280- func (l * maPacketConn ) ReadFrom (b []byte ) (int , ma.Multiaddr , error ) {
281- n , addr , err := l .PacketConn . ReadFrom (b )
277+ func (l * maPacketConn ) ReadFromMultiaddr (b []byte ) (int , ma.Multiaddr , error ) {
278+ n , addr , err := l .ReadFrom (b )
282279 maddr , _ := FromNetAddr (addr )
283280 return n , maddr , err
284281}
285282
286- func (l * maPacketConn ) WriteTo (b []byte , maddr ma.Multiaddr ) (int , error ) {
283+ func (l * maPacketConn ) WriteToMultiaddr (b []byte , maddr ma.Multiaddr ) (int , error ) {
287284 addr , err := ToNetAddr (maddr )
288285 if err != nil {
289286 return 0 , err
290287 }
291- return l .PacketConn . WriteTo (b , addr )
288+ return l .WriteTo (b , addr )
292289}
293290
294291// ListenPacket announces on the local network address laddr.
0 commit comments