Help us shape the future of Go! Take the 2026 Go Developer Survey

node

package
v1.49.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHost

func DefaultHost() string

Types

type Bye added in v1.45.0

type Bye string

func (Bye) Error added in v1.45.0

func (b Bye) Error() string

type Config

type Config struct {
	Name         string
	Host         string
	Version      string
	Mode         string
	Policy       *policy.Policy
	Hosts        *policy.Hosts
	Exit         bool
	Prefixes     []string
	Logf         func(format string, args ...any)
	Status       func(format string, args ...any)
	Certificates []webrtc.Certificate
}

type Event added in v1.18.0

type Event struct {
	Kind   EventKind
	Link   *link.Link
	Peer   link.Hello
	Stream string
	Reason string
	Count  int
	Err    error
}

type EventKind added in v1.18.0

type EventKind string
const (
	EventConnecting  EventKind = "connecting"
	EventLinked      EventKind = "linked"
	EventLinkDown    EventKind = "link-down"
	EventStreamOpen  EventKind = "stream-open"
	EventStreamClose EventKind = "stream-close"
	EventDropped     EventKind = "dropped"
)

type Node

type Node struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *Node

func (*Node) API

func (n *Node) API() *webrtc.API

func (*Node) Advertise added in v1.32.0

func (n *Node) Advertise(capability string)

func (*Node) Caps

func (n *Node) Caps() []string

func (*Node) Dialer

func (n *Node) Dialer() *policy.Dialer

func (*Node) Dropped added in v1.42.0

func (n *Node) Dropped(s *link.Stream, count int)

func (*Node) Handle

func (n *Node) Handle(capability, kind string, h link.Handler)

func (*Node) Hello

func (n *Node) Hello() link.Hello

func (*Node) Local added in v1.35.0

func (n *Node) Local() bool

func (*Node) Logf

func (n *Node) Logf(format string, args ...any)

func (*Node) OnHello added in v1.11.0

func (n *Node) OnHello(f func(*link.Hello))

func (*Node) Options

func (n *Node) Options() link.Options

func (*Node) PeerOrigin added in v1.35.0

func (n *Node) PeerOrigin(l *link.Link) string

func (*Node) Policy

func (n *Node) Policy() *policy.Policy

func (*Node) Resolver added in v1.16.0

func (n *Node) Resolver() *policy.Resolver

func (*Node) Serve

func (n *Node) Serve(ctx context.Context, conn signal.Conn) error

func (*Node) SetSSHHostKey

func (n *Node) SetSSHHostKey(key string)

func (*Node) Subscribe added in v1.18.0

func (n *Node) Subscribe(f func(Event)) func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL