CovenantSQL: github.com/CovenantSQL/CovenantSQL/naconn Index | Files

package naconn

import "github.com/CovenantSQL/CovenantSQL/naconn"

Package naconn provides node-oriented connection based on ETLS crypto connection.

This package requires a node ID resolver to work like a traditional DNS resolver, except that it resolves node IDs into IP addresses (and ports).

Index

Package Files

conn.go doc.go resolver.go secret.go

Constants

const (
    // HeaderSize is the header size with ETLSHeader + NodeID + Nonce.
    HeaderSize = etls.MagicSize + hash.HashBSize + cpuminer.Uint256Size
)

func Dial Uses

func Dial(remote proto.NodeID) (conn net.Conn, err error)

Dial connects to the node with remote node id.

func DialEx Uses

func DialEx(remote proto.NodeID, isAnonymous bool) (conn net.Conn, err error)

DialEx connects to the node with remote node id.

func GetSharedSecretWith Uses

func GetSharedSecretWith(resolver Resolver, nodeID *proto.RawNodeID, isAnonymous bool) (symmetricKey []byte, err error)

GetSharedSecretWith gets shared symmetric key with ECDH.

func RegisterResolver Uses

func RegisterResolver(resolver Resolver)

RegisterResolver registers the default resolver.

type NAConn Uses

type NAConn struct {
    *etls.CryptoConn
    // contains filtered or unexported fields
}

NAConn defines node aware connection based on ETLS crypto connection.

func Accept Uses

func Accept(conn net.Conn) (*NAConn, error)

Accept takes the ownership of conn and accepts it as a NAConn.

func NewServerConn Uses

func NewServerConn(conn net.Conn) *NAConn

NewServerConn takes a raw connection and returns a new server side NAConn.

func (*NAConn) Handshake Uses

func (c *NAConn) Handshake() (err error)

Handshake does the initial handshaking according to the connection role.

func (*NAConn) Remote Uses

func (c *NAConn) Remote() proto.RawNodeID

Remote returns the remote node ID of the NAConn.

type Remoter Uses

type Remoter interface {
    Remote() proto.RawNodeID
}

Remoter defines the interface to acquire remote node ID.

type Resolver Uses

type Resolver interface {
    Resolve(id *proto.RawNodeID) (string, error)
    ResolveEx(id *proto.RawNodeID) (*proto.Node, error)
}

Resolver defines the node ID resolver interface for node-oriented connection.

Package naconn imports 12 packages (graph) and is imported by 4 packages. Updated 2019-05-31. Refresh now. Tools for package owners.