Documentation ¶
Overview ¶
Package libtelio wraps generated Go bindings so that the rest of the project would not need C dependencies to run unit tests.
Index ¶
- Constants
- type Libtelio
- func (l *Libtelio) Disable() error
- func (l *Libtelio) Enable(ip netip.Addr, privateKey string) (err error)
- func (l *Libtelio) IsActive() bool
- func (l *Libtelio) NetworkChanged() error
- func (l *Libtelio) Private() string
- func (l *Libtelio) Public(private string) string
- func (l *Libtelio) Refresh(c mesh.MachineMap) error
- func (l *Libtelio) Start(creds vpn.Credentials, serverData vpn.ServerData) (err error)
- func (l *Libtelio) State() vpn.State
- func (l *Libtelio) StatusMap() (map[string]string, error)
- func (l *Libtelio) Stop() error
- func (l *Libtelio) Tun() tunnel.T
- type TelioConfig
- type TelioConfigFetcher
- type TelioLocalConfigFetcher
- type TelioRemoteConfigFetcher
Constants ¶
const (
// TelioLocalConfigName defines env key for local config value
TelioLocalConfigName = "TELIO_LOCAL_CFG"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Libtelio ¶
type Libtelio struct {
// contains filtered or unexported fields
}
Libtelio wrapper around generated Go bindings. Libtelio has 4 related methods and their combinations as following 1. Mesh disabled, calling Start - tunnel must be created with the API provided private key and the default IP address (10.5.0.2) 2. Mesh enabled, calling Start - tunnel must be re-used and connection to the VPN must be done with the meshnet private key and IP address 3. Mesh enabled, calling Stop - tunnel must stay as it is 4. Mesh disabled, calling Stop - tunnel must be destroyed 5. VPN connected, calling Enable - tunnel must be re-initiated with the meshnet private key and IP address, VPN connection must be re-initiated 6. VPN disconnected, calling Enable - tunnel must be initiated with the meshnet private key and IP address 7. VPN connected, calling Disable - tunnel must be re-initiated with the originally saved values provided to Start 8. VPN disconnected, calling Disable - tunnel must be destroyed
func (*Libtelio) Disable ¶
Disable the meshnet for libtelio. If VPN is not active, disable also destroys the tunnel. However, if it is active, original private key and IP address must be re-set to the ones given by the API because device is likely to be removed from the meshnet map and VPN servers will not recognize mesh IP and private key anymore.
func (*Libtelio) Enable ¶
Enable initiates the tunnel if it is not initiated yet. It can be initiated in case Start method was called before. If the tunnel is initiated and VPN is active, this function re-initiates the tunnel - sets the meshnet private key to libtelio and sets the meshnet IP address and re-creates a connection to VPN server with the new private key and IP. These should be supported by the VPN server if device is properly registered to meshnet map.
func (*Libtelio) NetworkChanged ¶
func (*Libtelio) Start ¶
func (l *Libtelio) Start( creds vpn.Credentials, serverData vpn.ServerData, ) (err error)
Start initiates the tunnel if it is not yet initiated and initiates the connection with the VPN server. If only VPN feature is used, tunnel should never be initiated when Start is called. If meshnet was enabled before, tunnel already exists and this function should re-use that and just initiate the connection
type TelioConfig ¶
type TelioConfig struct {
// contains filtered or unexported fields
}
func NewTelioConfig ¶
func NewTelioConfig(cm config.Manager) *TelioConfig
type TelioConfigFetcher ¶
TelioConfigFetcher is abstract interface to cover local and remote config
type TelioLocalConfigFetcher ¶
type TelioLocalConfigFetcher struct{}
func (*TelioLocalConfigFetcher) Fetch ¶
func (c *TelioLocalConfigFetcher) Fetch(string) (string, error)
func (*TelioLocalConfigFetcher) IsAvailable ¶
func (c *TelioLocalConfigFetcher) IsAvailable() bool
type TelioRemoteConfigFetcher ¶
type TelioRemoteConfigFetcher struct {
// contains filtered or unexported fields
}
func (*TelioRemoteConfigFetcher) Fetch ¶
func (c *TelioRemoteConfigFetcher) Fetch(appVer string) (string, error)
func (*TelioRemoteConfigFetcher) IsAvailable ¶
func (c *TelioRemoteConfigFetcher) IsAvailable() bool