security

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecureConn

type SecureConn struct {
	mnet.Conn
	// contains filtered or unexported fields
}

SecureConn is a simple wrapper around the underlying connection that holds remote peer information.

func (*SecureConn) ConnState

func (c *SecureConn) ConnState() network.ConnectionState

ConnState returns information about the connection state.

func (*SecureConn) LocalPeer

func (c *SecureConn) LocalPeer() peer.ID

LocalPeer returns our peer ID

func (*SecureConn) RemoteMultiaddr

func (c *SecureConn) RemoteMultiaddr() ma.Multiaddr

RemotePublicKey returns the public key of the remote peer.

func (*SecureConn) RemotePeer

func (c *SecureConn) RemotePeer() peer.ID

RemotePeer returns the peer ID of the remote peer.

func (*SecureConn) RemotePublicKey

func (c *SecureConn) RemotePublicKey() crypto.PubKey

RemotePublicKey returns the public key of the remote peer.

type SecureTransport

type SecureTransport struct {
	// contains filtered or unexported fields
}

SecureTransport provides a sec.SecureTransport that will automatically set up routes and compute addresses for peers as connections are opened.

func New

func New(id protocol.ID, host host.Host, psk pnet.PSK, privkey crypto.PrivKey) (*SecureTransport, error)

New is a standalone constructor for SecureTransport.

func (*SecureTransport) ID

func (st *SecureTransport) ID() protocol.ID

ID is the protocol ID of the security protocol.

func (*SecureTransport) NewSecureConn

func (c *SecureTransport) NewSecureConn(ctx context.Context, insecure mnet.Conn, rpeer peer.ID, psk pnet.PSK, dir network.Direction, iface wireguard.Interface) (*SecureConn, error)

NewSecureConn upgrades an insecure connection with peer identity.

func (*SecureTransport) SecureInbound

func (st *SecureTransport) SecureInbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)

SecureInbound secures an inbound connection. If p is empty, connections from any peer are accepted.

func (*SecureTransport) SecureOutbound

func (st *SecureTransport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)

SecureOutbound secures an outbound connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL