NetBirdSDK

package
v0.25.8 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeLog

func InitializeLog(logLevel string, filePath string) error

InitializeLog initializes the log file.

Types

type Auth

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

Auth can register or login new client

func NewAuth

func NewAuth(cfgPath string, mgmURL string) (*Auth, error)

NewAuth instantiate Auth struct and validate the management URL

func NewAuthWithConfig

func NewAuthWithConfig(ctx context.Context, config *internal.Config) *Auth

NewAuthWithConfig instantiate Auth based on existing config

func (*Auth) Login

func (a *Auth) Login() error

func (*Auth) LoginWithSetupKeyAndSaveConfig

func (a *Auth) LoginWithSetupKeyAndSaveConfig(setupKey string, deviceName string) error

LoginWithSetupKeyAndSaveConfig test the connectivity with the management server with the setup key.

func (*Auth) SaveConfigIfSSOSupported

func (a *Auth) SaveConfigIfSSOSupported() (bool, error)

SaveConfigIfSSOSupported test the connectivity with the management server by retrieving the server device flow info. If it returns a flow info than save the configuration and return true. If it gets a codes.NotFound, it means that SSO is not supported and returns false without saving the configuration. For other errors return false.

type Client

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

Client struct manage the life circle of background service

func NewClient

func NewClient(cfgFile, deviceName string, osVersion string, osName string, networkChangeListener NetworkChangeListener, dnsManager DnsManager) *Client

NewClient instantiate a new Client

func (*Client) ClearLoginComplete

func (c *Client) ClearLoginComplete()

func (*Client) GetStatusDetails

func (c *Client) GetStatusDetails() *StatusDetails

getStatusDetails return with the list of the PeerInfos

func (*Client) IsLoginComplete

func (c *Client) IsLoginComplete() bool

func (*Client) IsLoginRequired

func (c *Client) IsLoginRequired() bool

func (*Client) LoginForMobile

func (c *Client) LoginForMobile() string

func (*Client) RemoveConnectionListener

func (c *Client) RemoveConnectionListener()

RemoveConnectionListener remove connection listener

func (*Client) Run

func (c *Client) Run(fd int32, interfaceName string) error

Run start the internal client. It is a blocker function

func (*Client) SetConnectionListener

func (c *Client) SetConnectionListener(listener ConnectionListener)

SetConnectionListener set the network connection listener

func (*Client) SetTraceLogLevel

func (c *Client) SetTraceLogLevel()

ÏSetTraceLogLevel configure the logger to trace level

func (*Client) Stop

func (c *Client) Stop()

Stop the internal client and free the resources

type ConnectionListener

type ConnectionListener interface {
	peer.Listener
}

ConnectionListener export internal Listener for mobile

type CustomLogger

type CustomLogger interface {
	Debug(message string)
	Info(message string)
	Error(message string)
}

CustomLogger export internal CustomLogger for mobile

type DnsManager

type DnsManager interface {
	dns.IosDnsManager
}

DnsManager export internal dns Manager for mobile

type ErrListener

type ErrListener interface {
	OnSuccess()
	OnError(error)
}

ErrListener is async listener for mobile framework

type NetworkChangeListener

type NetworkChangeListener interface {
	listener.NetworkChangeListener
}

RouteListener export internal RouteListener for mobile

type PeerInfo

type PeerInfo struct {
	IP         string
	FQDN       string
	ConnStatus string // Todo replace to enum
}

PeerInfo describe information about the peers. It designed for the UI usage

type PeerInfoCollection

type PeerInfoCollection interface {
	Add(s string) PeerInfoCollection
	Get(i int) string
	Size() int
	GetFQDN() string
	GetIP() string
}

PeerInfoCollection made for Java layer to get non default types as collection

type Preferences

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

Preferences export a subset of the internal config for gomobile

func NewPreferences

func NewPreferences(configPath string) *Preferences

NewPreferences create new Preferences instance

func (*Preferences) Commit

func (p *Preferences) Commit() error

Commit write out the changes into config file

func (*Preferences) GetAdminURL

func (p *Preferences) GetAdminURL() (string, error)

GetAdminURL read url from config file

func (*Preferences) GetManagementURL

func (p *Preferences) GetManagementURL() (string, error)

GetManagementURL read url from config file

func (*Preferences) GetPreSharedKey

func (p *Preferences) GetPreSharedKey() (string, error)

GetPreSharedKey read preshared key from config file

func (*Preferences) SetAdminURL

func (p *Preferences) SetAdminURL(url string)

SetAdminURL store the given url and wait for commit

func (*Preferences) SetManagementURL

func (p *Preferences) SetManagementURL(url string)

SetManagementURL store the given url and wait for commit

func (*Preferences) SetPreSharedKey

func (p *Preferences) SetPreSharedKey(key string)

SetPreSharedKey store the given key and wait for commit

type SSOListener

type SSOListener interface {
	OnSuccess(bool)
	OnError(error)
}

SSOListener is async listener for mobile framework

type StatusDetails

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

StatusDetails is the implementation of the PeerInfoCollection

func (StatusDetails) Add

func (array StatusDetails) Add(s PeerInfo) StatusDetails

Add new PeerInfo to the collection

func (StatusDetails) Get

func (array StatusDetails) Get(i int) *PeerInfo

Get return an element of the collection

func (StatusDetails) GetFQDN

func (array StatusDetails) GetFQDN() string

GetFQDN return with the FQDN of the local peer

func (StatusDetails) GetIP

func (array StatusDetails) GetIP() string

GetIP return with the IP of the local peer

func (StatusDetails) Size

func (array StatusDetails) Size() int

Size return with the size of the collection

type URLOpener

type URLOpener interface {
	Open(string)
}

URLOpener it is a callback interface. The Open function will be triggered if the backend want to show an url for the user

Jump to

Keyboard shortcuts

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