Source File
addr.go
Belonging Package
github.com/libp2p/go-yamux/v5
package yamuximport ()// hasAddr is used to get the address from the underlying connectiontype hasAddr interface {LocalAddr() net.AddrRemoteAddr() net.Addr}// yamuxAddr is used when we cannot get the underlying addresstype yamuxAddr struct {Addr string}func (*yamuxAddr) () string {return "yamux"}func ( *yamuxAddr) () string {return fmt.Sprintf("yamux:%s", .Addr)}// Addr is used to get the address of the listener.func ( *Session) () net.Addr {return .LocalAddr()}// LocalAddr is used to get the local address of the// underlying connection.func ( *Session) () net.Addr {, := .conn.(hasAddr)if ! {return &yamuxAddr{"local"}}return .LocalAddr()}// RemoteAddr is used to get the address of remote end// of the underlying connectionfunc ( *Session) () net.Addr {, := .conn.(hasAddr)if ! {return &yamuxAddr{"remote"}}return .RemoteAddr()}// LocalAddr returns the local addressfunc ( *Stream) () net.Addr {return .session.LocalAddr()}// RemoteAddr returns the remote addressfunc ( *Stream) () net.Addr {return .session.RemoteAddr()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |