|
|
@ -1,6 +1,7 @@
|
|
|
|
package consul
|
|
|
|
package consul
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"encoding/binary"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
@ -112,3 +113,15 @@ func GetPrivateIP() (*net.IPNet, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil, fmt.Errorf("No private IP address found")
|
|
|
|
return nil, fmt.Errorf("No private IP address found")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Converts bytes to an integer
|
|
|
|
|
|
|
|
func bytesToUint64(b []byte) uint64 {
|
|
|
|
|
|
|
|
return binary.BigEndian.Uint64(b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Converts a uint to a byte slice
|
|
|
|
|
|
|
|
func uint64ToBytes(u uint64) []byte {
|
|
|
|
|
|
|
|
buf := make([]byte, 8)
|
|
|
|
|
|
|
|
binary.BigEndian.PutUint64(buf, u)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
|
|
|
|
}
|
|
|
|