Documentation
¶
Index ¶
- func DHCPNetworkService(ip chan string, l log.StandardLogger, maxTime time.Duration, leasedir string, ...) node.NetworkService
- func Logger(l log.StandardLogger) func(cfg *Config) error
- func NetLinkBootstrap(b bool) func(cfg *Config) error
- func Register(p ...Option) ([]node.Option, error)
- func VPNNetworkService(p ...Option) node.NetworkService
- func WithInterface(i *water.Interface) func(cfg *Config) error
- func WithInterfaceAddress(i string) func(cfg *Config) error
- func WithInterfaceMTU(i int) func(cfg *Config) error
- func WithInterfaceName(i string) func(cfg *Config) error
- func WithInterfaceType(d water.DeviceType) func(cfg *Config) error
- func WithLedgerAnnounceTime(t time.Duration) func(cfg *Config) error
- func WithMaxStreams(i int) func(cfg *Config) error
- func WithPacketMTU(i int) func(cfg *Config) error
- func WithRouterAddress(i string) func(cfg *Config) error
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DHCPNetworkService ¶
func DHCPNetworkService(ip chan string, l log.StandardLogger, maxTime time.Duration, leasedir string, address string) node.NetworkService
DHCPNetworkService 返回一个DHCP网络服务 参数 ip 为IP地址通道,l 为日志记录器,maxTime 为最大超时时间,leasedir 为租约目录,address 为基础地址
func NetLinkBootstrap ¶
NetLinkBootstrap 设置是否使用NetLink引导的选项
func Register ¶
Start the node and the vpn. Returns an error in case of failure When starting the vpn, there is no need to start the node Register 注册VPN服务,返回节点选项 启动节点和VPN。如果失败则返回错误 启动VPN时,无需单独启动节点
func VPNNetworkService ¶
func VPNNetworkService(p ...Option) node.NetworkService
VPNNetworkService 返回一个VPN网络服务,用于处理VPN连接和数据转发 参数 p 为可选的配置选项
func WithInterface ¶
WithInterface 设置网络接口的选项
func WithInterfaceAddress ¶
WithInterfaceAddress 设置接口IP地址的选项
func WithInterfaceMTU ¶
WithInterfaceMTU 设置接口MTU值的选项
func WithInterfaceName ¶
WithInterfaceName 设置接口名称的选项
func WithInterfaceType ¶
func WithInterfaceType(d water.DeviceType) func(cfg *Config) error
WithInterfaceType 设置接口设备类型的选项
func WithLedgerAnnounceTime ¶
WithLedgerAnnounceTime 设置账本公告时间间隔的选项
func WithRouterAddress ¶
WithRouterAddress 设置路由器地址的选项
Types ¶
type Config ¶
type Config struct {
Interface *water.Interface // 网络接口实例
InterfaceName string // 接口名称
InterfaceAddress string // 接口IP地址(CIDR格式)
RouterAddress string // 路由器地址
InterfaceMTU int // 接口MTU值
MTU int // 数据包MTU值
DeviceType water.DeviceType // 设备类型(TUN/TAP)
LedgerAnnounceTime time.Duration // 账本公告时间间隔
Logger log.StandardLogger // 日志记录器
NetLinkBootstrap bool // 是否使用NetLink引导
// Frame timeout 帧超时时间
Timeout time.Duration
Concurrency int // 并发处理数
ChannelBufferSize int // 通道缓冲区大小
MaxStreams int // 最大流数量
// contains filtered or unexported fields
}
Config VPN配置结构体,包含VPN接口和运行时参数
type Option ¶
Option 配置选项函数类型
LowProfile 低配置模式选项,启用后会限制资源使用
func DHCP ¶
func DHCP(l log.StandardLogger, maxTime time.Duration, leasedir string, address string) ([]node.Option, []Option)
DHCP 返回一个DHCP网络服务。它需要Alive服务来确定可用节点。 可用节点用于确定哪些节点需要IP,当maxTime过期时,节点被标记为离线并不再考虑。 参数 l 为日志记录器,maxTime 为最大超时时间,leasedir 为租约目录,address 为基础地址 返回节点选项和VPN选项
func WithChannelBufferSize ¶
WithChannelBufferSize 设置通道缓冲区大小的选项