|
|
@ -8,8 +8,6 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/op/go-logging"
|
|
|
|
"github.com/op/go-logging"
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
"crypto/rand"
|
|
|
|
|
|
|
|
"encoding/hex"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -128,18 +126,6 @@ func idGenLoop(done <-chan bool, out chan <- int) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func CreateRandomAddress(prefix string) (string,error) {
|
|
|
|
|
|
|
|
var bs [16]byte
|
|
|
|
|
|
|
|
n,err := rand.Read(bs[:])
|
|
|
|
|
|
|
|
if n != len(bs) {
|
|
|
|
|
|
|
|
return "", errors.New("incomplete read of random bytes for client name")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return "", errors.New("error reading random bytes for client name: "+ err.Error())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return prefix+ hex.EncodeToString(bs[:]),nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (mc *MsgConn) readLoop() {
|
|
|
|
func (mc *MsgConn) readLoop() {
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
if mc.processOneMessage() {
|
|
|
|
if mc.processOneMessage() {
|
|
|
|