wrtcip

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingIPs = errors.New("no IPs provided")
)

Functions

This section is empty.

Types

type Adapter

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

Adapter provides an IP service

func NewAdapter

func NewAdapter(
	signaler string,
	key string,
	ice []string,
	config *AdapterConfig,
	ctx context.Context,
) *Adapter

NewAdapter creates the adapter

func (*Adapter) Close

func (a *Adapter) Close() error

Close disconnects the adapter from the signaler and closes the TUN device

func (*Adapter) Open

func (a *Adapter) Open() error

Open connects the adapter to the signaler

func (*Adapter) Wait

func (a *Adapter) Wait() error

Wait starts the transmission loop

type AdapterConfig

type AdapterConfig struct {
	*wrtcconn.NamedAdapterConfig
	Device             string       // Name to give to the TUN device
	OnSignalerConnect  func(string) // Handler to be called when the adapter has connected to the signaler
	OnPeerConnect      func(string) // Handler to be called when the adapter has connected to a peer
	OnPeerDisconnected func(string) // Handler to be called when the adapter has received a message
	CIDRs              []string     // IPv4 & IPv6 networks to join
	MaxRetries         int          // Maximum amount of IP address to try and claim before giving up
	Parallel           int          // Maximum amount of goroutines to use to unmarshal IP packets
	Static             bool         // Claim the exact IP specified in the CIDR notation instead of selecting a random one from the networks
}

AdapterConfig configures the adapter

Jump to

Keyboard shortcuts

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