DHT-kademlia-P2Psec/pkg/dht_test_utilts.go
2024-09-13 14:04:40 +09:00

23 lines
318 B
Go

package kademlia
import (
"net"
"strconv"
)
func PacketsEqual(a, b []byte) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
func ConnectToApi(IP string, port int) (net.Conn, error) {
return net.Dial("tcp", IP+":"+strconv.Itoa(port))
}