Documentation
¶
Overview ¶
Package embed provides a way to embed the NetBird client directly into Go programs without requiring a separate NetBird client installation.
Index ¶
- Variables
- type Client
- func (c *Client) Dial(ctx context.Context, network, address string) (net.Conn, error)
- func (c *Client) ListenTCP(address string) (net.Listener, error)
- func (c *Client) ListenUDP(address string) (net.PacketConn, error)
- func (c *Client) NewHTTPClient() *http.Client
- func (c *Client) Start(startCtx context.Context) error
- func (c *Client) Stop(ctx context.Context) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var ErrClientAlreadyStarted = errors.New("client already started")
var ErrClientNotStarted = errors.New("client not started")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages a netbird embedded client instance
func (*Client) Dial ¶
Dial dials a network address in the netbird network. Not applicable if the userspace networking mode is disabled.
func (*Client) ListenTCP ¶
ListenTCP listens on the given address in the netbird network Not applicable if the userspace networking mode is disabled.
func (*Client) ListenUDP ¶
func (c *Client) ListenUDP(address string) (net.PacketConn, error)
ListenUDP listens on the given address in the netbird network Not applicable if the userspace networking mode is disabled.
func (*Client) NewHTTPClient ¶
NewHTTPClient returns a configured http.Client that uses the netbird network for requests. Not applicable if the userspace networking mode is disabled.
type Options ¶
type Options struct { // DeviceName is this peer's name in the network DeviceName string // SetupKey is used for authentication SetupKey string // ManagementURL overrides the default management server URL ManagementURL string PreSharedKey string // LogOutput is the output destination for logs (defaults to os.Stderr if nil) LogOutput io.Writer // LogLevel sets the logging level (defaults to info if empty) LogLevel string // NoUserspace disables the userspace networking mode. Needs admin/root privileges NoUserspace bool // ConfigPath is the path to the netbird config file. If empty, the config will be stored in memory and not persisted. ConfigPath string // StatePath is the path to the netbird state file StatePath string // DisableClientRoutes disables the client routes DisableClientRoutes bool }
Options configures a new Client