Involved Source Files Package netaddr provides endpoint and transport addresses for go-iroh.
An [EndpointAddr] combines a key.EndpointID with the network-level
[TransportAddr] values at which the endpoint may be reached. A transport
address is a [RelayAddr], [IPAddr], or [CustomAddr]. A [RelayURL] identifies
an iroh relay server.
The Go API is not stable before v1 and may change in any v0 release.endpointaddr.gorelayurl.go
Package-Level Type Names (total 6)
/* sort by: | */
CustomAddr is a custom transport address: a freely-chosen u64 transport id
plus opaque, unvalidated address data.
A registry of well-known transport ids is at
https://github.com/n0-computer/iroh/blob/main/TRANSPORTS.md.
CustomAddr mirrors upstream iroh's experimental custom-transport address
surface, which upstream excludes from its stability guarantees. The Go API
below follows this module's normal compatibility policy, but the
endpoint-ticket wire encoding of a CustomAddr may change to track upstream
without a major go-iroh version bump.
String encoding ([CustomAddr.String], [ParseCustomAddr]): "<id>_<data>" where
<id> is the transport ID as lowercase hex (no "0x", no leading zeros) and
<data> is the address bytes as lowercase hex.
Binary encoding ([CustomAddr.MarshalBinary], [CustomAddr.UnmarshalBinary]):
8-byte little-endian u64 ID followed by the raw data bytes (minimum 8 bytes).
CustomAddr mirrors upstream iroh's experimental custom-transport address
surface, which upstream excludes from its stability guarantees. The Go API
below follows this module's normal compatibility policy, but the
endpoint-ticket wire encoding of a CustomAddr may change to track upstream
without a major go-iroh version bump. Compare orders custom addresses by numeric transport id, then by data bytes. Data returns the opaque address data. ID returns the transport ID. MarshalBinary implements encoding.BinaryMarshaler using the binary encoding
described on [CustomAddr]. MarshalText implements encoding.TextMarshaler using the string encoding
described on [CustomAddr].( CustomAddr) Network() string( CustomAddr) String() string UnmarshalBinary implements encoding.BinaryUnmarshaler using the binary
encoding described on [CustomAddr]. UnmarshalText implements encoding.TextUnmarshaler using the string encoding
described on [CustomAddr].
CustomAddr : TransportAddr
CustomAddr : encoding.BinaryMarshaler
*CustomAddr : encoding.BinaryUnmarshaler
CustomAddr : encoding.TextMarshaler
*CustomAddr : encoding.TextUnmarshaler
CustomAddr : expvar.Var
CustomAddr : fmt.Stringer
CustomAddr : net.Addr
func NewCustomAddr(id uint64, data []byte) CustomAddr
func ParseCustomAddr(s string) (CustomAddr, error)
func github.com/tmc/go-iroh/internal/socket.Addr.Custom() (CustomAddr, bool)
func github.com/tmc/go-iroh/internal/socket.(*Socket).LookupCustom(m socket.CustomMappedAddr) (CustomAddr, bool)
func github.com/tmc/go-iroh/iroh.AdvertisingCustomTransport.LocalCustomAddrs(context.Context) ([]CustomAddr, error)
func github.com/tmc/go-iroh/internal/socket.CustomAddr(c CustomAddr) socket.Addr
func github.com/tmc/go-iroh/internal/socket.CustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.CustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.PacketTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.PacketTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.PacketTransport.SendPacket(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.PacketTransport.SendPacket(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/internal/socket.(*Socket).CustomMappedAddrFor(c CustomAddr) socket.CustomMappedAddr
func github.com/tmc/go-iroh/iroh.AdvertisingCustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/iroh.AdvertisingCustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/iroh.CustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
func github.com/tmc/go-iroh/iroh.CustomTransport.Send(remote CustomAddr, local *CustomAddr, p []byte) bool
EndpointAddr combines an endpoint's [key.EndpointID] with the network-level
addresses at which it may be reached.
To establish a connection both the key.EndpointID and at least one path (a relay
URL or a direct IP address) are needed; an EndpointAddr with no addresses is
still usable together with an address-lookup service. ID is the endpoint's identifier. Addrs returns the sorted, deduplicated transport addresses. IPAddrs returns the IP socket addresses of this endpoint. IsEmpty reports whether only the key.EndpointID is present. RelayURLs returns the relay URLs of this endpoint. In practice this is
expected to be zero or one home relay. String returns a diagnostic string for a. WithAddrs returns a copy of a with the given addresses added. The result's
address set is sorted and deduplicated. WithIP returns a copy of a with the given IP address added. WithRelayURL returns a copy of a with the given relay URL added.
EndpointAddr : expvar.Var
EndpointAddr : fmt.Stringer
func NewEndpointAddr(id key.EndpointID, addrs ...TransportAddr) EndpointAddr
func EndpointAddr.WithAddrs(addrs ...TransportAddr) EndpointAddr
func EndpointAddr.WithIP(ap netip.AddrPort) EndpointAddr
func EndpointAddr.WithRelayURL(u RelayURL) EndpointAddr
func github.com/tmc/go-iroh/dns.EndpointInfo.Addr() EndpointAddr
func github.com/tmc/go-iroh/endpointticket.Decode(s string) (EndpointAddr, error)
func github.com/tmc/go-iroh/endpointticket.ShortAddr(addr EndpointAddr) EndpointAddr
func github.com/tmc/go-iroh/endpointticket.Ticket.Addr() EndpointAddr
func github.com/tmc/go-iroh/iroh.(*Endpoint).Addr() EndpointAddr
func github.com/tmc/go-iroh/iroh.Item.Addr() EndpointAddr
func github.com/tmc/go-iroh/dns.EndpointDataFromAddr(addr EndpointAddr) dns.EndpointData
func github.com/tmc/go-iroh/dns.EndpointInfoFromAddr(addr EndpointAddr) dns.EndpointInfo
func github.com/tmc/go-iroh/endpointticket.Encode(addr EndpointAddr) string
func github.com/tmc/go-iroh/endpointticket.New(addr EndpointAddr) endpointticket.Ticket
func github.com/tmc/go-iroh/endpointticket.Short(addr EndpointAddr) endpointticket.Ticket
func github.com/tmc/go-iroh/endpointticket.ShortAddr(addr EndpointAddr) EndpointAddr
func github.com/tmc/go-iroh/internal/socket.(*RemoteMap).ResolveRemote(addr EndpointAddr) error
func github.com/tmc/go-iroh/internal/socket.(*RemoteStateActor).ResolveRemote(addr EndpointAddr) error
func github.com/tmc/go-iroh/iroh.StaticLookupFromAddrs(addrs ...EndpointAddr) *iroh.StaticLookup
func github.com/tmc/go-iroh/iroh.(*Endpoint).Connect(ctx context.Context, addr EndpointAddr, alpn string) (*iroh.Conn, error)
func github.com/tmc/go-iroh/iroh.(*Endpoint).ConnectEarly(ctx context.Context, addr EndpointAddr, alpn string) (*iroh.Connecting, error)
func github.com/tmc/go-iroh/iroh.(*Endpoint).Dial(ctx context.Context, addr EndpointAddr, alpn string) (net.Conn, error)
func github.com/tmc/go-iroh/iroh.EndpointHooks.BeforeConnect(ctx context.Context, addr EndpointAddr, alpn string) error
func github.com/tmc/go-iroh/iroh.(*MemoryLookup).AddEndpointAddr(addr EndpointAddr)
RelayAddr is a [TransportAddr] reachable via a relay server.URLRelayURL Compare orders relay addresses by their normalized URL string. MarshalText implements encoding.TextMarshaler using the string encoding
described on [TransportAddr].( RelayAddr) Network() string( RelayAddr) String() string UnmarshalText implements encoding.TextUnmarshaler using the string encoding
described on [TransportAddr].
RelayAddr : TransportAddr
RelayAddr : encoding.TextMarshaler
*RelayAddr : encoding.TextUnmarshaler
RelayAddr : expvar.Var
RelayAddr : fmt.Stringer
RelayAddr : net.Addr
TransportAddr is a network-level address at which an endpoint may be reached.
It is one of [RelayAddr], [IPAddr], or [CustomAddr].
The interface is closed: only the implementations in this package satisfy it. Compare returns -1, 0, or +1 ordering this address against other. The
order matches the Rust reference's derived Ord on the TransportAddr enum:
by kind first (relay < ip < custom), then by value (relay URLs by their
normalized string, IP addresses numerically, custom by id then data). Network returns the transport kind: "relay", "ip", or "custom". String renders the address in its "kind:value" form, e.g. "ip:127.0.0.1:9".CustomAddrIPAddrRelayAddr
TransportAddr : expvar.Var
TransportAddr : fmt.Stringer
TransportAddr : net.Addr
func ParseTransportAddr(s string) (TransportAddr, error)
func EndpointAddr.Addrs() []TransportAddr
func github.com/tmc/go-iroh/dns.EndpointData.Addrs() []TransportAddr
func github.com/tmc/go-iroh/iroh.IPOnlyFilter(addrs []TransportAddr) []TransportAddr
func github.com/tmc/go-iroh/iroh.RelayOnlyFilter(addrs []TransportAddr) []TransportAddr
func github.com/tmc/go-iroh/iroh.BiasedRttPathSelector.Select(current TransportAddr, candidates []iroh.PathCandidate) (TransportAddr, bool)
func github.com/tmc/go-iroh/iroh.PathSelector.Select(current TransportAddr, candidates []iroh.PathCandidate) (selected TransportAddr, ok bool)
func NewEndpointAddr(id key.EndpointID, addrs ...TransportAddr) EndpointAddr
func CustomAddr.Compare(other TransportAddr) int
func EndpointAddr.WithAddrs(addrs ...TransportAddr) EndpointAddr
func IPAddr.Compare(other TransportAddr) int
func RelayAddr.Compare(other TransportAddr) int
func TransportAddr.Compare(other TransportAddr) int
func github.com/tmc/go-iroh/dns.NewEndpointData(addrs ...TransportAddr) dns.EndpointData
func github.com/tmc/go-iroh/dns.(*EndpointData).AddAddrs(addrs ...TransportAddr)
func github.com/tmc/go-iroh/dns.EndpointData.WithAddrs(addrs ...TransportAddr) dns.EndpointData
func github.com/tmc/go-iroh/iroh.IPOnlyFilter(addrs []TransportAddr) []TransportAddr
func github.com/tmc/go-iroh/iroh.RelayOnlyFilter(addrs []TransportAddr) []TransportAddr
func github.com/tmc/go-iroh/iroh.BiasedRttPathSelector.Select(current TransportAddr, candidates []iroh.PathCandidate) (TransportAddr, bool)
func github.com/tmc/go-iroh/iroh.PathSelector.Select(current TransportAddr, candidates []iroh.PathCandidate) (selected TransportAddr, ok bool)
Package-Level Functions (total 6)
NewCustomAddr creates a CustomAddr from a transport ID and raw address data.
The data is copied.
NewEndpointAddr creates an EndpointAddr with the given id and transport
addresses. Addresses are deduplicated and sorted.
ParseCustomAddr parses a CustomAddr from its "<id>_<data>" string form.
It also accepts the "custom:" prefix used by [ParseTransportAddr].
ParseRelayURL parses s into a RelayURL. It returns an error wrapping
[ErrParseRelayURL] if s is not a valid URL.
ParseTransportAddr parses a TransportAddr from its "kind:value" string form.
RelayURLFromURL wraps an already-parsed URL as a RelayURL, normalizing it so
that equivalent URLs compare equal (see [RelayURL.String]).
Package-Level Variables (total 5)
CustomAddr parse/encode errors.
CustomAddr parse/encode errors.
CustomAddr parse/encode errors.
CustomAddr parse/encode errors.
ErrParseRelayURL is returned (wrapped) when a relay URL cannot be parsed.
The pages are generated with Goldsv0.8.4. (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.