??
This commit is contained in:
parent
f03dea9136
commit
b76d695401
5 changed files with 39 additions and 2 deletions
30
aurp/zone_info_test.go
Normal file
30
aurp/zone_info_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package aurp
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestZoneTuplesEncoding(t *testing.T) {
|
||||
zones := ZoneTuples{
|
||||
{
|
||||
Network: 0x64,
|
||||
Name: "The Twilight Zone",
|
||||
},
|
||||
}
|
||||
|
||||
b := bytes.NewBuffer(nil)
|
||||
zones.WriteTo(b)
|
||||
|
||||
got := b.Bytes()
|
||||
want := append([]byte{
|
||||
0x00, 0x01, // Number of zone tuples
|
||||
0x00, 0x64, // Network number
|
||||
0x11, // Length of string
|
||||
}, zones[0].Name...)
|
||||
if diff := cmp.Diff(got, want); diff != "" {
|
||||
t.Errorf("encoded zone tuples diff (-got +want):\n%s", diff)
|
||||
}
|
||||
}
|
5
go.mod
5
go.mod
|
@ -2,4 +2,7 @@ module gitea.drjosh.dev/josh/jrouter
|
|||
|
||||
go 1.22.0
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.1
|
||||
require (
|
||||
github.com/google/go-cmp v0.6.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,3 +1,5 @@
|
|||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
ethertalk:
|
||||
zone: The Twilight Zone
|
||||
net_start: 100
|
||||
net_end: 109
|
||||
net_end: 100
|
||||
|
||||
open_peering: true
|
||||
peers:
|
||||
|
|
2
main.go
2
main.go
|
@ -55,6 +55,8 @@ func main() {
|
|||
|
||||
log.Printf("Using %v as local domain identifier", localIP)
|
||||
|
||||
log.Printf("EtherTalk configuration: %+v", cfg.EtherTalk)
|
||||
|
||||
peers := make(map[udpAddr]*peer)
|
||||
var nextConnID uint16
|
||||
|
||||
|
|
Loading…
Reference in a new issue