const VERSION_GMTLS11
pub const VERSION_GMTLS11 = 257用途
常量 VERSION_GMTLS11,定义了相关的协议或算法配置参数。
#crypto/gmtlsGMTLS 1.1 子集(SM2 双证 + SM4)。进程内 net.pipe,无 Listen。零 C、非商密认证。
const VERSION_GMTLS11pub const VERSION_GMTLS11 = 257常量 VERSION_GMTLS11,定义了相关的协议或算法配置参数。
const ECC_SM4_GCM_SM3pub const ECC_SM4_GCM_SM3 = 57427常量 ECC_SM4_GCM_SM3,定义了相关的协议或算法配置参数。
const ECDHE_SM4_GCM_SM3pub const ECDHE_SM4_GCM_SM3 = 57425常量 ECDHE_SM4_GCM_SM3,定义了相关的协议或算法配置参数。
const ECC_SM4_CBC_SM3pub const ECC_SM4_CBC_SM3 = 57363常量 ECC_SM4_CBC_SM3,定义了相关的协议或算法配置参数。
const ECDHE_SM4_CBC_SM3pub const ECDHE_SM4_CBC_SM3 = 57361常量 ECDHE_SM4_CBC_SM3,定义了相关的协议或算法配置参数。
struct Configpub struct Config {
pub server_name string
pub client_name string
pub insecure_skip_verify bool
pub sign_cert string
pub sign_key string
pub enc_cert string
pub enc_key string
pub cipher_suite int
}Gmtls 配置参数与选项集合。
server_name stringclient_name stringinsecure_skip_verify boolsign_cert stringsign_key stringenc_cert stringenc_key stringcipher_suite intstruct Connpub struct Conn {
pub handshake_complete bool
pub cipher_suite int
pub server_name string
pub peer_sign_cert string
pub peer_enc_cert string
}承载 handshake_complete、cipher_suite、server_name、peer_sign_cert、peer_enc_cert 等属性的结构体。
handshake_complete boolcipher_suite intserver_name stringpeer_sign_cert stringpeer_enc_cert stringclientpub fn client(c net.PipeConn, cfg &Config) Conn客户端。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConncfg &ConfigConn — 该类型的值
client_with_rootspub fn client_with_roots(c net.PipeConn, cfg &Config, roots &x509.CertPool) Conn执行 client with roots 操作。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConncfg &Configroots &x509.CertPoolConn — 该类型的值
serverpub fn server(c net.PipeConn, cfg &Config) Conn服务端。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConncfg &ConfigConn — 该类型的值
server_with_rootspub fn server_with_roots(c net.PipeConn, cfg &Config, roots &x509.CertPool) Conn执行 server with roots 操作。失败时抛出错误,调用方需处理或继续传播。
c net.PipeConncfg &Configroots &x509.CertPoolConn — 该类型的值
($&Conn) writepub fn (c $&Conn) write(data &string) int$&Conn 上的操作:写入数据,返回写入的字节数。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。data &stringint — 写入的字节数
($&Conn) readpub fn (c $&Conn) read() string$&Conn 上的操作:读出最多 max 字节。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。string — 结果字符串
($&Conn) closepub fn (c $&Conn) close() int$&Conn 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。
c $&ConnConn 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值