diff options
author | Simon Rozman <simon@rozman.si> | 2019-05-16 10:34:09 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2019-05-16 10:36:28 +0200 |
commit | 852e38a360d47c7dc64798d1b051b2f61047fd8e (patch) | |
tree | a65c6f4208cde882003109437158456f3e712405 /conf | |
parent | firewall: allow wireguard.exe to override other rules (diff) | |
download | wireguard-windows-852e38a360d47c7dc64798d1b051b2f61047fd8e.tar.xz wireguard-windows-852e38a360d47c7dc64798d1b051b2f61047fd8e.zip |
global: change acronyms to uppercase
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'conf')
-rw-r--r-- | conf/config.go | 4 | ||||
-rw-r--r-- | conf/dnsresolver_windows.go | 6 | ||||
-rw-r--r-- | conf/parser.go | 8 | ||||
-rw-r--r-- | conf/writer.go | 16 |
4 files changed, 17 insertions, 17 deletions
diff --git a/conf/config.go b/conf/config.go index 80c5a7e3..b26dd09d 100644 --- a/conf/config.go +++ b/conf/config.go @@ -44,8 +44,8 @@ type Interface struct { PrivateKey Key Addresses []IPCidr ListenPort uint16 - Mtu uint16 - Dns []net.IP + MTU uint16 + DNS []net.IP } type Peer struct { diff --git a/conf/dnsresolver_windows.go b/conf/dnsresolver_windows.go index 3157a878..03ec793d 100644 --- a/conf/dnsresolver_windows.go +++ b/conf/dnsresolver_windows.go @@ -19,11 +19,11 @@ import ( //sys internetGetConnectedState(flags *uint32, reserved uint32) (connected bool) = wininet.InternetGetConnectedState //sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 -func resolveHostname(name string) (resolvedIpString string, err error) { +func resolveHostname(name string) (resolvedIPString string, err error) { const maxTries = 10 systemJustBooted := getTickCount64() <= uint64(time.Minute*4/time.Millisecond) for i := 0; i < maxTries; i++ { - resolvedIpString, err = resolveHostnameOnce(name) + resolvedIPString, err = resolveHostnameOnce(name) if err == nil { return } @@ -43,7 +43,7 @@ func resolveHostname(name string) (resolvedIpString string, err error) { return } -func resolveHostnameOnce(name string) (resolvedIpString string, err error) { +func resolveHostnameOnce(name string) (resolvedIPString string, err error) { hints := windows.AddrinfoW{ Family: windows.AF_UNSPEC, Socktype: windows.SOCK_DGRAM, diff --git a/conf/parser.go b/conf/parser.go index a8ccca07..e98a0244 100644 --- a/conf/parser.go +++ b/conf/parser.go @@ -253,7 +253,7 @@ func FromWgQuick(s string, name string) (*Config, error) { if err != nil { return nil, err } - conf.Interface.Mtu = m + conf.Interface.MTU = m case "address": addresses, err := splitList(val) if err != nil { @@ -276,7 +276,7 @@ func FromWgQuick(s string, name string) (*Config, error) { if a == nil { return nil, &ParseError{"Invalid IP address", address} } - conf.Interface.Dns = append(conf.Interface.Dns, a) + conf.Interface.DNS = append(conf.Interface.DNS, a) } default: return nil, &ParseError{"Invalid key for [Interface] section", key} @@ -345,8 +345,8 @@ func FromUAPI(s string, existingConfig *Config) (*Config, error) { Name: existingConfig.Name, Interface: Interface{ Addresses: existingConfig.Interface.Addresses, - Dns: existingConfig.Interface.Dns, - Mtu: existingConfig.Interface.Mtu, + DNS: existingConfig.Interface.DNS, + MTU: existingConfig.Interface.MTU, }, } var peer *Peer diff --git a/conf/writer.go b/conf/writer.go index ccc3024b..748c1d61 100644 --- a/conf/writer.go +++ b/conf/writer.go @@ -28,16 +28,16 @@ func (conf *Config) ToWgQuick() string { output.WriteString(fmt.Sprintf("Address = %s\n", strings.Join(addrStrings[:], ", "))) } - if len(conf.Interface.Dns) > 0 { - addrStrings := make([]string, len(conf.Interface.Dns)) - for i, address := range conf.Interface.Dns { + if len(conf.Interface.DNS) > 0 { + addrStrings := make([]string, len(conf.Interface.DNS)) + for i, address := range conf.Interface.DNS { addrStrings[i] = address.String() } output.WriteString(fmt.Sprintf("DNS = %s\n", strings.Join(addrStrings[:], ", "))) } - if conf.Interface.Mtu > 0 { - output.WriteString(fmt.Sprintf("MTU = %d\n", conf.Interface.Mtu)) + if conf.Interface.MTU > 0 { + output.WriteString(fmt.Sprintf("MTU = %d\n", conf.Interface.MTU)) } for _, peer := range conf.Peers { @@ -88,12 +88,12 @@ func (conf *Config) ToUAPI() (uapi string, dnsErr error) { } if !peer.Endpoint.IsEmpty() { - var resolvedIp string - resolvedIp, dnsErr = resolveHostname(peer.Endpoint.Host) + var resolvedIP string + resolvedIP, dnsErr = resolveHostname(peer.Endpoint.Host) if dnsErr != nil { return } - resolvedEndpoint := Endpoint{resolvedIp, peer.Endpoint.Port} + resolvedEndpoint := Endpoint{resolvedIP, peer.Endpoint.Port} output.WriteString(fmt.Sprintf("endpoint=%s\n", resolvedEndpoint.String())) } |