Documentation
¶
Index ¶
- type HolePunch
- func (d *HolePunch) DirectConnect(otherPeerAddr ma.Multiaddr) (network.Conn, error)
- func (d *HolePunch) HandlePeerDisconnect(_ peer.ID, msgPayload []byte)
- func (d *HolePunch) HolePunchAvailable(type1, type2 stun.NATDeviceType) bool
- func (d *HolePunch) ListenForNat(listenAddr []ma.Multiaddr, already []ma.Multiaddr) error
- func (d *HolePunch) SetHost(host host.Host) error
- func (d *HolePunch) SetTimeSpace(time int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HolePunch ¶
type HolePunch struct {
// contains filtered or unexported fields
}
HolePunch is one of way of nat traversal hole punch only success when udp and some nat type situation func HolePunchAvailable() can judge the situation if punch success
func NewHolePunch ¶
NewHolePunch .
@Description: new a HolePunch @param log: @return *HolePunch: @return error:
func (*HolePunch) DirectConnect ¶
DirectConnect .
@Description: try punch,if hole punch success return a networkConn and err is nil @receiver d @param otherPeerAddr: @return network.Conn: @return error:
func (*HolePunch) HandlePeerDisconnect ¶
HandlePeerDisconnect .
@Description: handle notify peer offline when get this msg,should stop holePunch to the peer immediately @receiver d @param _: @param msgPayload:
func (*HolePunch) HolePunchAvailable ¶
func (d *HolePunch) HolePunchAvailable(type1, type2 stun.NATDeviceType) bool
HolePunchAvailable .
@Description: provide a func to calculate a result if punch is available between two nat type @receiver d @param type1: @param type2: @return bool:
func (*HolePunch) ListenForNat ¶
ListenForNat .
@Description: called when nat change port @receiver d @param listenAddr: @param already: @return error:
func (*HolePunch) SetHost ¶
SetHost .
@Description: set host for HolePunch @receiver d @param host: need host.listen and dial @return error:
Click to show internal directories.
Click to hide internal directories.