DHT-kademlia-P2Psec/pkg/dht_test_utilts.go

23 lines
318 B
Go
Raw Permalink Normal View History

2024-09-13 07:04:40 +02:00
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))
}