package endpointticket

Import Path
	github.com/tmc/go-iroh/endpointticket (on go.dev)

Dependency Relation
	imports 11 packages, and imported by one package

Involved Source Files Package endpointticket encodes and decodes Rust-compatible iroh endpoint tickets. An endpoint ticket is a compact string form of an endpoint address for out-of-band sharing. The string starts with "endpoint" followed by lowercase base32 without padding. The Go API is not stable before v1 and may change in any v0 release. ticket.go
Code Examples package main import ( "fmt" "github.com/tmc/go-iroh/endpointticket" ) func main() { addr, err := endpointticket.Decode("endpointacxfr74igmsbvsbnn73wcecg5vt3kbzncqwfrdiampuufwnhkublmaqacbuhi5dqhixs6zdfojyc43lffyxqcad7aaaadaai") if err != nil { panic(err) } fmt.Println(addr.ID) fmt.Println(len(addr.Addrs())) }
Package-Level Type Names (total 6)
/* sort by: | */
Decoder decodes a ticket from its byte representation. func (*Registry).Register(kind string, decoder Decoder) error
ParseError reports a structured ticket parse failure. Err error Expected string Kind ParseErrorKind Message string (*ParseError) Error() string (*ParseError) Is(target error) bool (*ParseError) Unwrap() error *ParseError : error *ParseError : golang.org/x/xerrors.Wrapper var ErrDecode *ParseError var ErrEncoding *ParseError var ErrMissingPrefix *ParseError var ErrVerify *ParseError
ParseErrorKind classifies ticket parse failures. const ParseErrorKindEncoding const ParseErrorKindKind const ParseErrorKindPostcard const ParseErrorKindVerify
Registry decodes tickets by kind. DecodeBytes decodes bytes as a ticket of kind. DecodeString decodes s using the registered kind prefix. Register adds decoder for kind. Kind must be non-empty and unique. func NewRegistry() *Registry func RegisterEndpoint(r *Registry) error
Ticket is an endpoint ticket. Addr returns the endpoint address in t. EncodeBytes returns the ticket's byte representation. EncodeString returns the encoded ticket string. Kind returns the ticket kind prefix. MarshalText implements encoding.TextMarshaler. Short returns a ticket containing only the endpoint id and relay URLs. String returns the encoded ticket string. UnmarshalText implements encoding.TextUnmarshaler. Ticket : TicketCodec Ticket : encoding.TextMarshaler *Ticket : encoding.TextUnmarshaler Ticket : expvar.Var Ticket : fmt.Stringer func DecodeBytes(b []byte) (Ticket, error) func DecodeString(s string) (Ticket, error) func New(addr netaddr.EndpointAddr) Ticket func Parse(s string) (Ticket, error) func Short(addr netaddr.EndpointAddr) Ticket func Ticket.Short() Ticket
TicketCodec is the generic shape of an iroh ticket implementation. It mirrors Rust's iroh_tickets::Ticket trait: a ticket has a lowercase kind prefix, a byte representation, and a canonical string form of kind plus base32-without-padding bytes. ( TicketCodec) EncodeBytes() []byte ( TicketCodec) EncodeString() string ( TicketCodec) Kind() string Ticket func (*Registry).DecodeBytes(kind string, b []byte) (TicketCodec, error) func (*Registry).DecodeString(s string) (TicketCodec, error) func EncodeString(t TicketCodec) string
Package-Level Functions (total 11)
Decode parses s as an endpoint ticket and returns its endpoint address.
DecodeBytes decodes an endpoint ticket from its byte representation.
DecodeString parses s as an endpoint ticket.
Encode returns the ticket string for addr.
EncodeString returns t's canonical string form.
New returns a ticket for addr.
NewRegistry returns an empty ticket decoder registry.
Parse parses s as an endpoint ticket.
RegisterEndpoint registers the endpoint ticket decoder in r.
Short returns a ticket for addr containing only the endpoint id and relay URLs.
ShortAddr returns addr with direct IP and custom addresses removed.
Package-Level Variables (total 7)
ErrDecode is returned when the decoded bytes are not a valid endpoint ticket payload.
ErrEncoding is returned when the ticket payload is not valid base32.
ErrMissingPrefix is returned when a ticket does not start with "endpoint".
ErrTrailingBytes is returned when a ticket has extra data after the endpoint address.
ErrTruncated is returned when a ticket ends before a complete field.
ErrVarintOverflow is returned when a varint field exceeds 64 bits.
ErrVerify is returned when decoded bytes fail semantic validation.
Package-Level Constants (total 6)
Kind is the string prefix for endpoint tickets.
MaxAddrs is the maximum number of addresses accepted in a ticket. It is a memory-exhaustion guard, not a wire-compatibility limit.
ParseErrorKindEncoding means the ticket payload was not valid base32.
ParseErrorKindKind means the ticket string had the wrong kind prefix.
ParseErrorKindPostcard means the payload looked like this ticket kind but did not decode as the ticket byte format.
ParseErrorKindVerify means decoded bytes failed semantic validation.