Documentation
¶
Index ¶
- type Config
- type Server
- func (s *Server) Close() error
- func (s *Server) DeleteUser(user string)
- func (s *Server) GetFingerprint() string
- func (s *Server) ResetUsers(users []*settings.User)
- func (s *Server) Run(host, port string) error
- func (s *Server) Start(host, port string) error
- func (s *Server) StartContext(ctx context.Context, host, port string) error
- func (s *Server) Wait() error
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
KeySeed string
// 一个可选的user.json路径。这个文件是一个对象,如下定义:{"<user:pass>": ["<addr-regex>","<addr-regex>"]}
// 当使用<user>连接时,<pass>将被验证,然后每个远程地址将与列表进行正则匹配
// 普通远程地址形式:<remote-host>:<remote-port>
// 用于反向端口转发远程地址形式:R:<local-interface>:<local-port>
AuthFile string
// 形式为:<user:pass>,可选。
// 等价于authfile {"<user:pass>": [""]},如果未设置,则将使用AUTH环境变量
Auth string
// 代理
Proxy string
// 是否允许客户端访问内部的SOCKS5代理
Socks5 bool
// 反向端口转发,是否允许客户端指定反向端口转发
Reverse bool
// 可选的保活间隔。 由于底层传输是HTTP,在许多情况下我们将遍历代理,这些代理通常会关闭空闲连接。
// 您必须使用单位指定时间,例如“5s”或“2m”。 默认为“25s”(设置为 0s 以禁用)。
KeepAlive time.Duration
// 传输层安全协议的设置
TLS TLSConfig
OnConnect func(localPort, remotePort string, tun *tunnel.Tunnel)
OnClose func(localPort string)
// 使用隧道转发请求时创建连接的回调
OnForwardingConnect func(localPort string, logger *cio.Logger)
// 使用隧道转发请求时结束连接的回调
OnForwardingClose func(localPort string, logger *cio.Logger)
}
Config server配置
type Server ¶
func (*Server) DeleteUser ¶
DeleteUser removes a user from the server user index
func (*Server) ResetUsers ¶
ResetUsers in the server user index. Use nil to remove all.
func (*Server) StartContext ¶
StartContext 启动http服务器,可以通过取消提供的上下文来关闭
type TLSConfig ¶
type TLSConfig struct {
// 启用TLS,并提供pem编码的TLS私钥的可选路径。
// 设置此标志时,还必须设置——tls-cert,并且不能设置tls-domain
Key string
// 启用TLS,并为pem编码的TLS证书提供可选路径。
// 设置此标志时,还必须设置tls-key,并且不能设置tls-domain
Cert string
// 启用TLS,并使用LetsEncypt自动获取TLS密钥和证书。需要指定端口443。
// 你可以指定多个tls-domain标志来服务多个域。
// 生成的文件缓存在$HOME/.cache/chisel目录中。
// 可以通过设置CHISEL_LE_CACHE环境变量来修改该路径,
// 或者通过将这个变量设置为"-"来禁用缓存。通过设置CHISEL_LE_EMAIL,您可以选择提供证书通知电子邮件
Domains []string
// 一个PEM编码的CA证书包的路径,或者一个存放多个PEM编码CA证书包文件的目录,用于验证客户端连接。
// 提供的CA证书将代替系统根证书。这通常用于实现mutual-TLS
CA string
}
TLSConfig Transport Layer Security 传输层安全协议的设置
Click to show internal directories.
Click to hide internal directories.