Documentation ¶
Index ¶
- Constants
- func Discover(ctx context.Context, h host.Host, dht *dht.IpfsDHT, rendezvous string)
- func GetHostAddress(ha host.Host) string
- func GetHostOnlyAddress(ha host.Host) string
- func NewDHT(ctx context.Context, host host.Host, bootstrapPeers []multiaddr.Multiaddr) (d *dht.IpfsDHT, e error)
- type ByteChan
- type Conn
- type DuplexByteChan
- type Listener
- func (l *Listener) Accept() <-chan *Conn
- func (l *Listener) AddConn(d *Conn)
- func (l *Listener) DelConn(d *Conn)
- func (l *Listener) Dial(multiAddr string) (d *Conn)
- func (l *Listener) FindConn(multiAddr string) (d *Conn)
- func (l *Listener) GetConnRecv(multiAddr string) (recv tpt.Transport)
- func (l *Listener) GetConnSend(multiAddr string) (send tpt.Transport)
- func (l *Listener) SetMTU(mtu int)
Constants ¶
const ( // LocalhostZeroIPv4TCP is the default localhost to bind to any address. Used in // tests. LocalhostZeroIPv4TCP = "/ip4/127.0.0.1/tcp/0" // DefaultMTU is the default maximum size for a packet. DefaultMTU = 1382 // ConnBufs is the number of buffers to use in message dispatch channels. ConnBufs = 8192 // IndraLibP2PID is the indra protocol identifier. IndraLibP2PID = "/indra/relay/" + indra.SemVer )
Variables ¶
This section is empty.
Functions ¶
func GetHostAddress ¶
func GetHostOnlyAddress ¶
Types ¶
type ByteChan ¶
func NewByteChan ¶
type Conn ¶
type Conn struct { network.Conn MTU int RemoteKey *crypto.Pub MultiAddr multiaddr.Multiaddr Host host.Host Transport *DuplexByteChan sync.Mutex qu.C // contains filtered or unexported fields }
func (*Conn) GetRemoteKey ¶
func (*Conn) SetRemoteKey ¶
type DuplexByteChan ¶
DuplexByteChan is intended to be connected up in chains with other processing steps as a pipeline. The send and receive functions send bytes to their respective send and receive channels, and the processing is added by a consuming type by listening to the send channel for requests to send, and forwarding data from the upstream to the receive channel.
func NewDuplexByteChan ¶
func NewDuplexByteChan(bufs int) *DuplexByteChan
func NewSimDuplex ¶
func NewSimDuplex(bufs int, ctx context.Context) (d *DuplexByteChan)
NewSimDuplex creates a DuplexByteChan that behaves like a single ByteChan by forwarding from the send channel to the receiver channel. This creates something like a virtual in memory packet connection, as used in many of the Onion tests for testing correct forwarding without a full network.
A network-using version of the same tests should also work exactly the same.
func (*DuplexByteChan) Receive ¶
func (d *DuplexByteChan) Receive() (C <-chan slice.Bytes)