mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-27 06:10:26 +08:00
feat(p2p): add ICMP backend support
This commit is contained in:
@@ -20,7 +20,7 @@ func (ep *EndPoint) Network() string {
|
||||
return ep.addr.Network()
|
||||
}
|
||||
|
||||
func (ep *EndPoint) Euqal(ep2 p2p.EndPoint) bool {
|
||||
func (ep *EndPoint) Equal(ep2 p2p.EndPoint) bool {
|
||||
if ep == nil || ep2 == nil {
|
||||
return ep == nil && ep2 == nil
|
||||
}
|
||||
@@ -64,6 +64,9 @@ func (conn *Conn) LocalAddr() p2p.EndPoint {
|
||||
|
||||
func (conn *Conn) ReadFromPeer(b []byte) (int, p2p.EndPoint, error) {
|
||||
n, addr, err := conn.conn.ReadFromIP(b)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
return n, &EndPoint{
|
||||
addr: addr,
|
||||
ptcl: conn.ep.ptcl,
|
||||
|
||||
Reference in New Issue
Block a user