pkg/{encapsulation,mesh}: abstract encapsulation

This commit abstracts away encapsulation to more easily allow for
different types of encapsulation or compatibility with other networking
solutions.
This commit is contained in:
Lucas Servén Marín
2019-05-13 18:30:00 +02:00
parent d7ad946ff4
commit cd6eeeb1e7
7 changed files with 169 additions and 46 deletions

View File

@@ -20,6 +20,7 @@ import (
"testing"
"github.com/kylelemons/godebug/pretty"
"github.com/squat/kilo/pkg/encapsulation"
"github.com/squat/kilo/pkg/wireguard"
"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"
@@ -978,7 +979,7 @@ func TestRoutes(t *testing.T) {
},
},
} {
routes := tc.topology.Routes(kiloIface, privIface, pubIface, tc.local, NeverEncapsulate)
routes := tc.topology.Routes(kiloIface, privIface, pubIface, tc.local, encapsulation.Never)
if diff := pretty.Compare(routes, tc.result); diff != "" {
t.Errorf("test case %q: got diff: %v", tc.name, diff)
}