revised ad magic and fixed address test
This commit is contained in:
@@ -68,9 +68,7 @@ func (x *Ad) Decode(s *splice.Splice) (e error) {
|
||||
}
|
||||
|
||||
func (x *Ad) Encode(s *splice.Splice) (e error) {
|
||||
log.T.S("encoding", reflect.TypeOf(x),
|
||||
x.ID, x.Sig,
|
||||
)
|
||||
log.T.S("encoding", reflect.TypeOf(x), x)
|
||||
x.Splice(s)
|
||||
return
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/indra-labs/indra/pkg/util/splice"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
@@ -23,7 +24,7 @@ func TestNew(t *testing.T) {
|
||||
if ma, e = multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/4242"); fails(e) {
|
||||
t.FailNow()
|
||||
}
|
||||
aa := New(id, pr, ma)
|
||||
aa := New(id, pr, ma, time.Now().Add(time.Hour*24*7))
|
||||
s := splice.New(aa.Len())
|
||||
if e = aa.Encode(s); fails(e) {
|
||||
t.FailNow()
|
||||
@@ -24,7 +24,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
Magic = "peer"
|
||||
Magic = "pead"
|
||||
Len = adproto.Len +
|
||||
slice.Uint32Len
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
Magic = "prot"
|
||||
Magic = "prad"
|
||||
Len = magic.Len +
|
||||
nonce.IDLen +
|
||||
crypto.PubKeyLen +
|
||||
|
||||
Reference in New Issue
Block a user