TlsConnection
struct TlsConnection
A TLS connection.
Implementions
Methods
connect
pub fn connect(conn: Connection, domain: string, alpn_protocols: [string]? = nil): TlsConnection throws IoError
[src]
pub fn connect(
conn: Connection, domain: string, alpn_protocols: [string]? = nil
): TlsConnection throws IoError {
let tls_conn = try _TlsConnection
.connect(_create_native_readwrite(conn), domain, alpn_protocols);
return TlsConnection { tls_conn, conn };
}
Initiates a TLS handshake over the given connection.
connect
pub fn connect(conn: Connection, domain: string, alpn_protocols: [string]? = nil): TlsConnection throws IoError
[src]
pub fn connect(
conn: Connection, domain: string, alpn_protocols: [string]? = nil
): TlsConnection throws IoError {
let tls_conn = try _TlsConnection
.connect(_create_native_readwrite(conn), domain, alpn_protocols);
return TlsConnection { tls_conn, conn };
}
Initiates a TLS handshake over the given connection.
Initiates a TLS handshake over the given connection.
Arguments
domain
: The domain name to connect to.conn
: The underlying connection.alpn_protocols
: A list of ALPN protocols to offer to the peer. Ifnil
, no ALPN negotiation will be attempted.
Example
nv,no_run
use std.net.{TcpConnection, TlsConnection};
fn main() throws {
let conn = try TcpConnection.connect("example.com:443");
let tls_conn = try TlsConnection.connect(conn, "example.com");
}
alpn_protocol
pub fn alpn_protocol(self): string?
[src]
pub fn alpn_protocol(self): string? {
return self.tls_conn.alpn_protocol();
}
Retrieves the protocol agreed with the peer via ALPN.
alpn_protocol
pub fn alpn_protocol(self): string?
[src]
pub fn alpn_protocol(self): string? {
return self.tls_conn.alpn_protocol();
}
Retrieves the protocol agreed with the peer via ALPN.
Retrieves the protocol agreed with the peer via ALPN.
A return value of nil
after handshake completion means no protocol was agreed (because no protocols were offered or accepted by the peer).
local_addr
pub fn local_addr(self): Addr?
[src]
pub fn local_addr(self): Addr? {
return self.conn.local_addr();
}
local_addr
pub fn local_addr(self): Addr?
[src]
pub fn local_addr(self): Addr? {
return self.conn.local_addr();
}
remote_addr
pub fn remote_addr(self): Addr?
[src]
pub fn remote_addr(self): Addr? {
return self.conn.remote_addr();
}
remote_addr
pub fn remote_addr(self): Addr?
[src]
pub fn remote_addr(self): Addr? {
return self.conn.remote_addr();
}
[src]
pub fn close(self) throws IoError {
try self.conn.close();
}
[src]
pub fn close(self) throws IoError {
try self.conn.close();
}
[src]
pub fn read(self, buf: Bytes): int throws IoError {
return try self.tls_conn.read(buf);
}
[src]
pub fn read(self, buf: Bytes): int throws IoError {
return try self.tls_conn.read(buf);
}
[src]
pub fn write(self, bytes: Bytes): int throws IoError {
return try self.tls_conn.write(bytes);
}
[src]
pub fn write(self, bytes: Bytes): int throws IoError {
return try self.tls_conn.write(bytes);
}