Skip to content

Commit fe3d4a9

Browse files
committed
chore(all): make code compilable for other platforms than Linux
1 parent de38d75 commit fe3d4a9

35 files changed

+192
-194
lines changed

cmd/gluetun/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ type Linker interface {
581581
LinkDel(link netlink.Link) (err error)
582582
LinkSetUp(link netlink.Link) (linkIndex int, err error)
583583
LinkSetDown(link netlink.Link) (err error)
584-
LinkSetMTU(link netlink.Link, mtu int) error
584+
LinkSetMTU(link netlink.Link, mtu uint32) error
585585
}
586586

587587
type clier interface {

internal/netlink/address.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build linux || darwin
2-
31
package netlink
42

53
import (

internal/netlink/address_unspecified.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

internal/netlink/family.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ import (
44
"fmt"
55
)
66

7-
const (
8-
FamilyAll = 0
9-
FamilyV4 = 2
10-
FamilyV6 = 10
11-
)
12-
137
func FamilyToString(family int) string {
148
switch family {
159
case FamilyAll:

internal/netlink/family_linux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package netlink
2+
3+
import "golang.org/x/sys/unix"
4+
5+
const (
6+
FamilyAll = unix.AF_UNSPEC
7+
FamilyV4 = unix.AF_INET
8+
FamilyV6 = unix.AF_INET6
9+
)

internal/netlink/link.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build linux || darwin
2-
31
package netlink
42

53
import "github.com/vishvananda/netlink"
@@ -62,8 +60,8 @@ func (n *NetLink) LinkSetDown(link Link) (err error) {
6260
return netlink.LinkSetDown(linkToNetlinkLink(&link))
6361
}
6462

65-
func (n *NetLink) LinkSetMTU(link Link, mtu int) error {
66-
return netlink.LinkSetMTU(linkToNetlinkLink(&link), mtu)
63+
func (n *NetLink) LinkSetMTU(link Link, mtu uint32) error {
64+
return netlink.LinkSetMTU(linkToNetlinkLink(&link), int(mtu))
6765
}
6866

6967
type netlinkLinkImpl struct {

internal/netlink/link_unspecified.go

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//go:build !linux
2+
3+
package netlink
4+
5+
const (
6+
// FamilyAll is a placeholder only and should not
7+
// be used.
8+
FamilyAll = iota
9+
// FamilyV4 is a placeholder only and should not
10+
// be used.
11+
FamilyV4
12+
// FamilyV6 is a placeholder only and should not
13+
// be used.
14+
FamilyV6
15+
)
16+
17+
func (n *NetLink) RuleList(family int) (rules []Rule, err error) {
18+
panic("not implemented")
19+
}
20+
21+
func (n *NetLink) RuleAdd(rule Rule) error {
22+
panic("not implemented")
23+
}
24+
25+
func (n *NetLink) RuleDel(rule Rule) error {
26+
panic("not implemented")
27+
}
28+
29+
func (n *NetLink) IsWireguardSupported() bool {
30+
panic("not implemented")
31+
}

internal/netlink/route.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build linux || darwin
2-
31
package netlink
42

53
import (

internal/netlink/route_unspecified.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)