revised ad magic and fixed address test

This commit is contained in:
херетик
2023-06-17 09:08:13 +01:00
parent ea63945f1c
commit 5380d5f01e
4 changed files with 5 additions and 6 deletions

View File

@@ -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
}

View File

@@ -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()

View File

@@ -24,7 +24,7 @@ var (
)
const (
Magic = "peer"
Magic = "pead"
Len = adproto.Len +
slice.Uint32Len
)

View File

@@ -23,7 +23,7 @@ var (
)
const (
Magic = "prot"
Magic = "prad"
Len = magic.Len +
nonce.IDLen +
crypto.PubKeyLen +