config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name is a unique node name (across all regions).
	// It is not a host name.
	// It's typically of the form "1b", "2a", "3b", etc. (region
	// ID + suffix within that region)
	Name string `yaml:"name"`

	// Region is the Region of the RelayRegion that this node
	// is running in.
	Region string `yaml:"region"`

	// Host describes the host information about the relay server.
	Host string `yaml:"host,omitempty"`

	Port int `yaml:"port,omitempty"`

	// Port optionally specifies a STUN port to use.
	// Zero means 3478.
	// To disable STUN on this node, use -1.
	// https://datatracker.ietf.org/doc/html/rfc5389#section-18.4
	STUNPort int `yaml:"stunPort,omitempty"`

	DHKey  *security.DHKey `yaml:"dhKey"`
	Portal *Portal         `yaml:"portal"`
}

Config represents the configuration of the relay server

func FromBytes

func FromBytes(data []byte) (*Config, error)

FromBytes returns the configuration instance from bytes

func FromPath

func FromPath(path string) (*Config, error)

FromPath returns the configuration instance from file path

func FromReader

func FromReader(reader io.Reader) (*Config, error)

FromReader returns the configuration instance from reader

func New

func New() *Config

New returns a config instance with default value

type Portal

type Portal struct {
	Key string `yaml:"key"`
	URL string `yaml:"url"`
	// Keepalive interval between portal/relay services.
	KeepaliveInterval time.Duration `yaml:"keepaliveInterval,omitempty"`
	// Sync peer online status after a sync interval.
	SyncInterval time.Duration `yaml:"syncInterval,omitempty"`
}

Portal represents the gateway instance configuration

Jump to

Keyboard shortcuts

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