Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
NetworkConfig, NetworkToken string // 网络配置和网络令牌
Address string // IP地址
ListenMaddrs []string // 监听多地址
DHTAnnounceMaddrs []multiaddr.Multiaddr // DHT公告多地址
Router string // 路由器地址
Interface string // 接口名称
Libp2pLogLevel, LogLevel string // libp2p日志级别和日志级别
LowProfile, BootstrapIface bool // 低配置模式和引导接口
Blacklist []string // 黑名单
Concurrency int // 并发数
FrameTimeout string // 帧超时
ChannelBufferSize, InterfaceMTU, PacketMTU int // 通道缓冲区大小、接口MTU、数据包MTU
NAT NAT // NAT配置
Connection Connection // 连接配置
Discovery Discovery // 发现配置
Ledger Ledger // 账本配置
Limit ResourceLimit // 资源限制
Privkey []byte // 私钥
// PeerGuard (实验性)
// 启用peerguardian并添加特定的认证选项
PeerGuard PeerGuard
Whitelist []multiaddr.Multiaddr // 白名单
}
Config 是节点和默认EdgeVPN服务的配置结构体 用于在启动前为节点和服务生成选项
type Connection ¶
type Connection struct {
HolePunch bool // 是否启用打洞
AutoRelay bool // 是否启用自动中继
AutoRelayDiscoveryInterval time.Duration // 自动中继发现间隔
StaticRelays []string // 静态中继列表
OnlyStaticRelays bool // 仅使用静态中继
PeerTable map[string]peer.ID // 对等节点表
MaxConnections int // 最大连接数
LowWater int // 低水位线
HighWater int // 高水位线
}
Connection 是连接服务相关的配置部分
type Discovery ¶
type Discovery struct {
DHT, MDNS bool // 是否启用DHT和mDNS发现
BootstrapPeers []string // 引导节点列表
Interval time.Duration // 发现间隔
}
Discovery 允许启用/禁用发现并设置引导节点
type Ledger ¶
type Ledger struct {
AnnounceInterval, SyncInterval time.Duration // 公告间隔和同步间隔
StateDir string // 状态目录
}
Ledger 是账本配置结构
type NAT ¶
type NAT struct {
Service bool // 是否启用NAT服务
Map bool // 是否启用NAT映射
RateLimit bool // 是否启用速率限制
RateLimitGlobal, RateLimitPeer int // 全局速率限制和对等节点速率限制
RateLimitInterval time.Duration // 速率限制间隔
}
NAT 是NAT配置设置相关的结构 允许启用/禁用服务和NAT映射,以及速率限制
type PeerGuard ¶
type PeerGuard struct {
Enable bool // 是否启用
Relaxed bool // 宽松模式
Autocleanup bool // 自动清理
PeerGate bool // 对等节点门控
// AuthProviders 以自由映射形式提供认证提供者:
// ecdsa:
// private_key: "foo_bar"
AuthProviders map[string]map[string]interface{} // 认证提供者配置
SyncInterval time.Duration // 同步间隔
}
PeerGuard 对等节点保护配置
type ResourceLimit ¶
type ResourceLimit struct {
FileLimit string // 限制文件路径
LimitConfig *rcmgr.PartialLimitConfig // 限制配置
Scope string // 作用域
MaxConns int // 最大连接数
StaticMin int64 // 静态最小值
StaticMax int64 // 静态最大值
Enable bool // 是否启用
}
ResourceLimit 资源限制配置
Click to show internal directories.
Click to hide internal directories.