rtcconfig

package
v0.0.0-...-559fa5e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 21 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStunServers = []string{
	"global.stun.twilio.com:3478",
	"stun.l.google.com:19302",
	"stun1.l.google.com:19302",
}

Functions

func GetExternalIP

func GetExternalIP(ctx context.Context, stunServers []string, localAddr net.Addr) (string, error)

GetExternalIP return external IP for localAddr from stun server. If localAddr is nil, a local address is chosen automatically, else the address will be used to validate the external IP is accessible from the outside.

func GetLocalIPAddresses

func GetLocalIPAddresses(includeLoopback bool, preferredInterfaces []string) ([]string, error)

func IPFilterFromConf

func IPFilterFromConf(ips IPsConfig) (func(ip net.IP) bool, error)

func InterfaceFilterFromConf

func InterfaceFilterFromConf(ifs InterfacesConfig) func(string) bool

Types

type BatchIOConfig

type BatchIOConfig struct {
	BatchSize        int           `yaml:"batch_size,omitempty"`
	MaxFlushInterval time.Duration `yaml:"max_flush_interval,omitempty"`
}

type IPsConfig

type IPsConfig struct {
	Includes []string `yaml:"includes,omitempty"`
	Excludes []string `yaml:"excludes,omitempty"`
}

type InterfacesConfig

type InterfacesConfig struct {
	Includes []string `yaml:"includes,omitempty"`
	Excludes []string `yaml:"excludes,omitempty"`
}

type PortRange

type PortRange struct {
	Start int `yaml:"start,omitempty"`
	End   int `yaml:"end,omitempty"`
}

func (PortRange) MarshalYAML

func (r PortRange) MarshalYAML() (interface{}, error)

func (*PortRange) ToSlice

func (r *PortRange) ToSlice() []int

func (*PortRange) UnmarshalString

func (r *PortRange) UnmarshalString(str string) error

func (*PortRange) UnmarshalYAML

func (r *PortRange) UnmarshalYAML(value *yaml.Node) error

func (*PortRange) Valid

func (r *PortRange) Valid() bool

type RTCConfig

type RTCConfig struct {
	UDPPort                 PortRange        `yaml:"udp_port,omitempty"`
	TCPPort                 uint32           `yaml:"tcp_port,omitempty"`
	ICEPortRangeStart       uint32           `yaml:"port_range_start,omitempty"`
	ICEPortRangeEnd         uint32           `yaml:"port_range_end,omitempty"`
	NodeIP                  string           `yaml:"node_ip,omitempty"`
	NodeIPAutoGenerated     bool             `yaml:"-"`
	STUNServers             []string         `yaml:"stun_servers,omitempty"`
	UseExternalIP           bool             `yaml:"use_external_ip"`
	UseICELite              bool             `yaml:"use_ice_lite,omitempty"`
	Interfaces              InterfacesConfig `yaml:"interfaces,omitempty"`
	IPs                     IPsConfig        `yaml:"ips,omitempty"`
	EnableLoopbackCandidate bool             `yaml:"enable_loopback_candidate"`
	UseMDNS                 bool             `yaml:"use_mdns,omitempty"`
	// when UseExternalIP is true, only advertise the external IP to client
	ExternalIPOnly bool          `yaml:"external_ip_only,omitempty"`
	BatchIO        BatchIOConfig `yaml:"batch_io,omitempty"`

	// for testing, disable UDP
	ForceTCP bool `yaml:"force_tcp,omitempty"`
}

func (*RTCConfig) Validate

func (conf *RTCConfig) Validate(development bool) error

type WebRTCConfig

type WebRTCConfig struct {
	Configuration  webrtc.Configuration
	SettingEngine  webrtc.SettingEngine
	UDPMux         ice.UDPMux
	TCPMuxListener *net.TCPListener
	NAT1To1IPs     []string
	UseMDNS        bool
}

func NewWebRTCConfig

func NewWebRTCConfig(rtcConf *RTCConfig, development bool) (*WebRTCConfig, error)

Jump to

Keyboard shortcuts

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