-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_windows.go
53 lines (45 loc) · 1.01 KB
/
config_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//go:build windows
package swiftunnel
import (
"github.com/XenonCommunity/swiftunnel/swiftypes"
"net"
)
type DriverType int
const (
DriverTypeWintun DriverType = iota
DriverTypeOpenVPN
)
type Config struct {
AdapterName string
AdapterTypeName string
AdapterGUID swiftypes.GUID
AdapterType swiftypes.AdapterType
DriverType DriverType
MTU int
DNSConfig *swiftypes.DNSConfig
UnicastConfig *swiftypes.UnicastConfig
}
func NewDefaultConfig() Config {
ip, ipNet, err := net.ParseCIDR("10.18.21.1/24")
if err != nil {
panic(err)
}
return Config{
AdapterName: "Swiftunnel VPN",
AdapterTypeName: "Swiftunnel",
AdapterType: swiftypes.AdapterTypeTUN,
DriverType: DriverTypeWintun,
MTU: 1500,
DNSConfig: &swiftypes.DNSConfig{
DnsServers: []net.IP{
net.IPv4(8, 8, 8, 8),
net.IPv4(8, 8, 4, 4),
},
},
UnicastConfig: &swiftypes.UnicastConfig{
IP: ip,
IPNet: ipNet,
DadState: swiftypes.IpDadStatePreferred,
},
}
}