Documentation ¶
Overview ¶
Package insecure provides an insecure, unencrypted implementation of the SecureConn and SecureTransport interfaces.
Recommended only for testing and other non-production usage.
Index ¶
Constants ¶
const ID = "/plaintext/2.0.0"
ID is the multistream-select protocol ID that should be used when identifying this security transport.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn is the connection type returned by the insecure transport.
func (*Conn) ConnState ¶ added in v0.24.0
func (ic *Conn) ConnState() network.ConnectionState
ConnState returns the security connection's state information.
func (*Conn) RemotePeer ¶
RemotePeer returns the remote peer ID if we initiated the dial. Otherwise, it returns "" (because this connection isn't actually secure).
func (*Conn) RemotePublicKey ¶
RemotePublicKey returns whatever public key was given by the remote peer. Note that no verification of ownership is done, as this connection is not secure.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a no-op stream security transport. It provides no security and simply mocks the security methods. Identity methods return the local peer's ID and private key, and whatever the remote peer presents as their ID and public key. No authentication of the remote identity is performed.
func NewWithIdentity ¶
NewWithIdentity constructs a new insecure transport. The public key is sent to remote peers. No security is provided.
func (*Transport) SecureInbound ¶
func (t *Transport) SecureInbound(_ context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)
SecureInbound *pretends to secure* an inbound connection to the given peer. It sends the local peer's ID and public key, and receives the same from the remote peer. No validation is performed as to the authenticity or ownership of the provided public key, and the key exchange provides no security.
SecureInbound may fail if the remote peer sends an ID and public key that are inconsistent with each other, or if a network error occurs during the ID exchange.
func (*Transport) SecureOutbound ¶
func (t *Transport) SecureOutbound(_ context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)
SecureOutbound *pretends to secure* an outbound connection to the given peer. It sends the local peer's ID and public key, and receives the same from the remote peer. No validation is performed as to the authenticity or ownership of the provided public key, and the key exchange provides no security.
SecureOutbound may fail if the remote peer sends an ID and public key that are inconsistent with each other, or if the ID sent by the remote peer does not match the one dialed. It may also fail if a network error occurs during the ID exchange.