Documentation ¶
Index ¶
- func Listen(network, laddr string, config *noise.Config) (net.Listener, error)
- type Conn
- func Client(conn net.Conn, config *noise.Config) *Conn
- func Dial(network, addr string, localAddr string, config *noise.Config) (*Conn, error)
- func DialWithDialer(dialer *net.Dialer, network, addr, localAddr string, config *noise.Config) (*Conn, error)
- func Server(conn net.Conn, config *noise.Config) *Conn
- func (c *Conn) Close() error
- func (c *Conn) Handshake() (err error)
- func (c *Conn) IsRemoteAuthenticated() bool
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (int, error)
- type Listener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a secured connection. It implements the net.Conn interface.
func Client ¶
Client returns a new Noise client side connection using conn as the underlying transport. The config cannot be nil: users must set either ServerName or InsecureSkipVerify in the config.
func Dial ¶
Dial connects to the given network address using net.Dial and then initiates a Noise handshake, returning the resulting Noise connection.
func DialWithDialer ¶
func DialWithDialer(dialer *net.Dialer, network, addr, localAddr string, config *noise.Config) (*Conn, error)
DialWithDialer connects to the given network address using dialer.Dial and then initiates a Noise handshake, returning the resulting Noise connection. Any timeout or deadline given in the dialer apply to connection and Noise handshake as a whole.
func Server ¶
Server returns a new Noise server side connection using net.Conn as the underlying transport. The configuration config must be non-nil and must include at least one certificate or else set GetCertificate.
func (*Conn) Handshake ¶
Handshake runs the client or server handshake protocol if it has not yet been run. Most uses of this package need not call Handshake explicitly: the first Read or Write will call it automatically.
func (*Conn) IsRemoteAuthenticated ¶
IsRemoteAuthenticated can be used to check if the remote peer has been properly authenticated. It serves no real purpose for the moment as the handshake will not go through if a peer is not properly authenticated in patterns where the peer needs to be authenticated.
func (*Conn) Read ¶
Read can be made to time out and return a net.Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. A zero value for t means Read and Write will not time out. After a Write has timed out, the Noise state is corrupt and all future writes will return the same error.
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the read deadline on the underlying connection. A zero value for t means Read will not time out.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the write deadline on the underlying connection. A zero value for t means Write will not time out. After a Write has timed out, the Noise state is corrupt and all future writes will return the same error.