const VERSION_GMTLS11
pub const VERSION_GMTLS11 = 257Purpose
Constant VERSION_GMTLS11, defining protocol or algorithm parameters.
#crypto/gmtlsGMTLS 1.1 subset (dual SM2 certs + SM4). In-process net.pipe; no Listen. Pure Xu, not commercial-crypto certified.
const VERSION_GMTLS11pub const VERSION_GMTLS11 = 257Constant VERSION_GMTLS11, defining protocol or algorithm parameters.
const ECC_SM4_GCM_SM3pub const ECC_SM4_GCM_SM3 = 57427Constant ECC_SM4_GCM_SM3, defining protocol or algorithm parameters.
const ECDHE_SM4_GCM_SM3pub const ECDHE_SM4_GCM_SM3 = 57425Constant ECDHE_SM4_GCM_SM3, defining protocol or algorithm parameters.
const ECC_SM4_CBC_SM3pub const ECC_SM4_CBC_SM3 = 57363Constant ECC_SM4_CBC_SM3, defining protocol or algorithm parameters.
const ECDHE_SM4_CBC_SM3pub const ECDHE_SM4_CBC_SM3 = 57361Constant ECDHE_SM4_CBC_SM3, defining protocol or algorithm parameters.
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
}sign_key / enc_key: 32-byte raw d, PKCS#8/SEC1 DER, or PEM (PRIVATE KEY / EC PRIVATE KEY / SM2 PRIVATE KEY). sign_cert / enc_cert: DER or PEM CERTIFICATE / X509 CERTIFICATE. server_name: ClientHello SNI (RFC 6066) when non-empty; client also matches it against the server sign certificate DNS SAN / CN unless empty or insecure_skip_verify. client_name: ECDHE server matches it against the client sign certificate DNS SAN / CN unless empty or insecure_skip_verify (does not check the encryption certificate). ECDHE client Config.sign_cert/enc_cert are the client's dual certs and need not match the server. Conn.peer_sign_cert / peer_enc_cert are the peer's presented dual certs (DER). ECC server leaves them empty (no client certs).
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
}Structure encapsulating 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) ConnExecute client. Throws on failure; handle the error or propagate it to the caller.
c net.PipeConncfg &ConfigConn — a value of this type
client_with_rootspub fn client_with_roots(c net.PipeConn, cfg &Config, roots &x509.CertPool) ConnClient with roots. Throws on failure; handle the error or propagate it to the caller.
c net.PipeConncfg &Configroots &x509.CertPoolConn — a value of this type
serverpub fn server(c net.PipeConn, cfg &Config) ConnExecute server. Throws on failure; handle the error or propagate it to the caller.
c net.PipeConncfg &ConfigConn — a value of this type
server_with_rootspub fn server_with_roots(c net.PipeConn, cfg &Config, roots &x509.CertPool) ConnServer with roots. Throws on failure; handle the error or propagate it to the caller.
c net.PipeConncfg &Configroots &x509.CertPoolConn — a value of this type
($&Conn) writepub fn (c $&Conn) write(data &string) intOperation on $&Conn: write data and return the byte count. Throws on failure; handle the error or propagate it to the caller.
c $&ConnConn instance used by this call (exclusive borrow).data &stringint — bytes written
($&Conn) readpub fn (c $&Conn) read() stringOperation on $&Conn: read up to max bytes. Throws on failure; handle the error or propagate it to the caller.
c $&ConnConn instance used by this call (exclusive borrow).string — result string
($&Conn) closepub fn (c $&Conn) close() intOperation on $&Conn: close the resource. Throws on failure; handle the error or propagate it to the caller.
c $&ConnConn instance used by this call (exclusive borrow).int — a value of this type