const DEFAULT_TIMEOUT_NS
pub const DEFAULT_TIMEOUT_NS = 30000000000Purpose
Constant DEFAULT_TIMEOUT_NS, defining protocol or algorithm parameters.
#github.com/xulang-org/packages/transportShared client transport for external drivers. A connection keeps the complete TLS state when secure is true. Callers must pass Conn values around instead of retaining only fd; an fd alone cannot represent a live TLS session.
github.com/xulang-org/packages · 1.0.2 · Install and use
const DEFAULT_TIMEOUT_NSpub const DEFAULT_TIMEOUT_NS = 30000000000Constant DEFAULT_TIMEOUT_NS, defining protocol or algorithm parameters.
const MAX_HEADER_BYTESpub const MAX_HEADER_BYTES = 1048576Constant MAX_HEADER_BYTES, defining protocol or algorithm parameters.
const MAX_MESSAGE_BYTESpub const MAX_MESSAGE_BYTES = 10485760Constant MAX_MESSAGE_BYTES, defining protocol or algorithm parameters.
struct Endpointpub struct Endpoint {
pub scheme string
pub host string
pub port int
pub path string
pub secure bool
}Structure encapsulating scheme, host, port, path, secure.
scheme stringhost stringport intpath stringsecure boolstruct Connpub struct Conn {
pub fd int
pub tls_conn tls.Conn
pub secure bool
pub closed bool
pub eof bool
pub buf string
}Structure encapsulating fd, tls_conn, secure, closed, eof.
fd inttls_conn tls.Connsecure boolclosed booleof boolbuf stringparse_endpointpub fn parse_endpoint(raw string, fallback_port int) Endpointparse_endpoint accepts scheme://host[:port][/path] and host[:port]. The path is retained for callers that need a base URL; query handling is intentionally left to the individual protocol driver. Throws on failure; handle the error or propagate it to the caller.
raw stringfallback_port intEndpoint — a value of this type
secure_endpointpub fn secure_endpoint(ep Endpoint) boolSecure endpoint.
ep Endpointbool — true or false
dialpub fn dial(ep Endpoint, cfg tls.Config, timeout_ns int) ConnDial a connection. Throws on failure; handle the error or propagate it to the caller.
ep Endpointcfg tls.Configtimeout_ns intConn — a value of this type
from_fdpub fn from_fd(fd int) ConnBuild from fd. Throws on failure; handle the error or propagate it to the caller.
fd intConn — a value of this type
closed_connpub fn closed_conn() ConnClosed connection.
No arguments are required.
Conn — a value of this type
($&Conn) readpub fn (c $&Conn) read(max int) 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).max intstring — result string
($&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) write_allpub fn (c $&Conn) write_all(data string) intOperation on $&Conn: write all. Throws on failure; handle the error or propagate it to the caller.
c $&ConnConn instance used by this call (exclusive borrow).data stringint — a value of this type
($&Conn) closepub fn (c $&Conn) close() intOperation on $&Conn: close the resource.
c $&ConnConn instance used by this call (exclusive borrow).int — a value of this type
request_rawpub fn request_raw(ep Endpoint, cfg tls.Config, request string, method string) http.Responserequest_raw performs one HTTP request on a fresh connection. It is used by drivers while their legacy plaintext fd pools are being migrated to Conn pools; the TLS handshake and certificate verification still happen here. Throws on failure; handle the error or propagate it to the caller.
ep Endpointcfg tls.Configrequest stringmethod stringhttp.Response — a value of this type
read_responsepub fn read_response(c $&Conn, method string) http.Responseread_response reads one HTTP/1.x response while retaining bytes belonging to the next response in Conn.buf. It works for both TCP and TLS sessions. Throws on failure; handle the error or propagate it to the caller.
c $&Connmethod stringhttp.Response — a value of this type