const VERSION_TLS12
pub const VERSION_TLS12 = 771用途
常量 VERSION_TLS12,定义了相关的协议或算法配置参数。
#crypto/tlsXu 实现的 TLS 1.2/1.3 客户端子集;系统根证书默认校验。当前后端的 ECDH、RSA、AES 与 GHASH 为可变时间实现。
const VERSION_TLS12pub const VERSION_TLS12 = 771常量 VERSION_TLS12,定义了相关的协议或算法配置参数。
const VERSION_TLS13pub const VERSION_TLS13 = 772常量 VERSION_TLS13,定义了相关的协议或算法配置参数。
const TLS_AES_128_GCM_SHA256pub const TLS_AES_128_GCM_SHA256 = 4865常量 TLS_AES_128_GCM_SHA256,定义了相关的协议或算法配置参数。
const TLS_RSA_WITH_AES_128_GCM_SHA256pub const TLS_RSA_WITH_AES_128_GCM_SHA256 = 156常量 TLS_RSA_WITH_AES_128_GCM_SHA256,定义了相关的协议或算法配置参数。
const TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256pub const TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 49195常量 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,定义了相关的协议或算法配置参数。
const TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256pub const TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 49199常量 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,定义了相关的协议或算法配置参数。
struct Configpub struct Config {
pub server_name string
pub insecure_skip_verify bool
pub root_cas x509.CertPool
pub cert_pem string
pub key_pem string
}Tls 配置参数与选项集合。
server_name stringinsecure_skip_verify boolroot_cas x509.CertPoolcert_pem stringkey_pem stringstruct Dialerpub struct Dialer {
pub timeout_ns int
pub config Config
}承载 timeout_ns、config 等属性的结构体。
timeout_ns intconfig Configstruct Connpub struct Conn {
pub server_name string
pub handshake_complete bool
pub cipher_suite int
pub version int
pub negotiated_protocol string
pub read_deadline_ns int
pub write_deadline_ns int
}承载 server_name、handshake_complete、cipher_suite、version、negotiated_protocol 等属性的结构体。
server_name stringhandshake_complete boolcipher_suite intversion intnegotiated_protocol stringread_deadline_ns intwrite_deadline_ns intstruct ConnectionStatepub struct ConnectionState {
pub server_name string
pub handshake_complete bool
pub cipher_suite int
pub version int
pub negotiated_protocol string
}承载 server_name、handshake_complete、cipher_suite、version、negotiated_protocol 等属性的结构体。
server_name stringhandshake_complete boolcipher_suite intversion intnegotiated_protocol stringnew_configpub fn new_config(server_name string) Config构造 config。
server_name stringConfig — 该类型的值
($&Config) set_next_protospub fn (c $&Config) set_next_protos(protocols []string)$&Config 上的操作:设置 next protos。
c $&ConfigConfig 实例;以独占借用传入,方法可修改它,调用方仍持有实例。protocols []string不返回值。
new_dialerpub fn new_dialer() Dialer构造 dialer。
无需传入参数。
Dialer — 该类型的值
closed_connpub fn closed_conn() Conn执行 closed conn 操作。
无需传入参数。
Conn — 该类型的值
clientpub fn client(c net.Conn, config &Config) Conn客户端。失败时抛出错误,调用方需处理或继续传播。
c net.Connconfig &ConfigConn — 该类型的值
client_pipepub fn client_pipe(c net.PipeConn, config &Config) Conn执行 client pipe 操作。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConnconfig &ConfigConn — 该类型的值
serverpub fn server(c net.Conn, config &Config) Conn服务端。失败时抛出错误,调用方需处理或继续传播。
c net.Connconfig &ConfigConn — 该类型的值
server_pipepub fn server_pipe(c net.PipeConn, config &Config) Conn执行 server pipe 操作。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConnconfig &ConfigConn — 该类型的值
client_fdpub fn client_fd(fd int, server_name string) Conn执行 client fd 操作。失败时抛出错误,调用方需处理或继续传播。
fd intserver_name stringConn — 该类型的值
dialpub fn dial(network string, addr string, config &Config) Conn发起连接。失败时抛出错误,调用方需处理或继续传播。
network stringaddr stringconfig &ConfigConn — 该类型的值
dial_contextpub fn dial_context(ctx &context.Context, network string, addr string, config &Config) Conn带上下文拨号。失败时抛出错误,调用方需处理或继续传播。
ctx &context.Contextnetwork stringaddr stringconfig &ConfigConn — 该类型的值
(Dialer) dialpub fn (d Dialer) dial(network string, addr string) ConnDialer 上的操作:发起连接。失败时抛出错误,调用方需处理或继续传播。
d DialerDialer 实例;按值接收。network stringaddr stringConn — 该类型的值
(Dialer) dial_contextpub fn (d Dialer) dial_context(ctx &context.Context, network string, addr string) ConnDialer 上的操作:带上下文拨号。失败时抛出错误,调用方需处理或继续传播。
d DialerDialer 实例;按值接收。ctx &context.Contextnetwork stringaddr stringConn — 该类型的值
(&Conn) handshakepub fn (c &Conn) handshake() int在 &Conn 上执行 handshake 操作。失败时抛出错误,调用方需处理或继续传播。
c &ConnConn 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(Conn) connection_statepub fn (c Conn) connection_state() ConnectionStateConn 上的操作:执行 connection state 操作。
c ConnConn 实例;按值接收。ConnectionState — 该类型的值
($&Conn) set_deadlinepub fn (c $&Conn) set_deadline(t_ns int) int$&Conn 上的操作:设置 deadline。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。t_ns intint — 该类型的值
($&Conn) set_read_deadlinepub fn (c $&Conn) set_read_deadline(t_ns int) int$&Conn 上的操作:设置 read deadline。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。t_ns intint — 该类型的值
($&Conn) set_write_deadlinepub fn (c $&Conn) set_write_deadline(t_ns int) int$&Conn 上的操作:设置 write deadline。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。t_ns intint — 该类型的值
($&Conn) readpub fn (c $&Conn) read(max int) string$&Conn 上的操作:读出最多 max 字节。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。max intstring — 结果字符串
($&Conn) writepub fn (c $&Conn) write(data &string) int$&Conn 上的操作:写入数据,返回写入的字节数。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。data &stringint — 写入的字节数
($&Conn) closepub fn (c $&Conn) close() int$&Conn 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值
($&Conn) read_resultpub fn (c $&Conn) read_result(n int) io.ReadResult$&Conn 上的操作:读取结果。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。n intio.ReadResult — 该类型的值
($&Conn) write_resultpub fn (c $&Conn) write_result(data string) io.WriteResult$&Conn 上的操作:写入结果。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。data stringio.WriteResult — 该类型的值