Keeta LogoKeeta Logo@keetanetwork/keetanet-client
    Preparing search index...

    Interface P2PConnection

    Represents an active connection on the P2P network

    interface P2PConnection {
        abort: boolean;
        close: () => Promise<void>;
        connString: string;
        peer: null | P2PPeer;
        peerString: null | string;
        send: (data: Buffer) => Promise<boolean>;
        serialize?: () => SerializedConnection;
        timeout: number;
        validatedPeer: null | P2PPeer;
    }
    Index

    Properties

    abort: boolean

    Signal to abort the connection

    close: () => Promise<void>

    Method to close this connection

    connString: string

    Printable form of the connection

    peer: null | P2PPeer

    Peer information, if null the peer has not yet greeted us so we do not know who they are

    peerString: null | string

    Printable form of the peer

    send: (data: Buffer) => Promise<boolean>

    Method to send a message to this peer

    serialize?: () => SerializedConnection

    If this connection can be serialized to our KV store, return the type.

    See P2PSwitch.RegisterP2PConnectionDeserializer for registering a handler to convert it back

    timeout: number

    Timeout of when to close this connection (Date.valueOf)

    validatedPeer: null | P2PPeer

    The peering information is normally untrusted since it just what the peer gave us once it has been validated we can populate this.

    Validation can be via a callback to the peer or a certificate

    A callback isn't as reliable since it could be a MITM proxy