23 lines
318 B
Go
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))
|
||
|
}
|