client

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Time
	RetryPeriod = 1 * time.Second

	// Time allowed to write a message to the CDS server.
	WriteWait = 2 * time.Second

	// Time allowed to read the next pong message from the CDS server.
	PongWait = 8 * time.Second

	// Send pings to the CDS server with this period. Must be less than PongWait.
	PingPeriod = 5 * time.Second
)

Functions

func ParseConfig

func ParseConfig(c []byte) (*stnrv1.StunnerConfig, error)

ParseConfig parses a raw buffer holding a configuration, substituting environment variables for placeholders in the configuration. Returns the new configuration or error if parsing fails.

func ZeroConfig

func ZeroConfig(id string) *stnrv1.StunnerConfig

ZeroConfig builds a zero configuration useful for bootstrapping STUNner. It starts with plaintext authentication and opens no listeners and clusters.

Types

type Client

type Client interface {
	// Load grabs a new configuration from the config client.
	Load() (*stnrv1.StunnerConfig, error)
	// Watch listens to new configurations and returns them on the channel ch. The context ctx
	// cancels the watcher.
	Watch(ctx context.Context, ch chan<- stnrv1.StunnerConfig) error
	fmt.Stringer
}

Client represents a generic config client. Currently supported config providers: http, ws, or file. Configuration obtained through the client are not validated, make sure to validate on the receiver side.

func NewClient

func NewClient(origin string, id string, logger logging.LoggerFactory) (Client, error)

GetConfig returns the configuration of the running STUNner daemon.

type ConfigSkeleton added in v0.16.1

type ConfigSkeleton struct {
	ApiVersion string `json:"version"`
}

Jump to

Keyboard shortcuts

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