global: apply gofumpt
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
2dd424e2d8
commit
9c9e7e2724
28 changed files with 56 additions and 71 deletions
|
|
@ -42,8 +42,11 @@ type netTun struct {
|
|||
dnsServers []netip.Addr
|
||||
hasV4, hasV6 bool
|
||||
}
|
||||
type endpoint netTun
|
||||
type Net netTun
|
||||
|
||||
type (
|
||||
endpoint netTun
|
||||
Net netTun
|
||||
)
|
||||
|
||||
func (e *endpoint) Attach(dispatcher stack.NetworkDispatcher) {
|
||||
e.dispatcher = dispatcher
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ func CreateTUN(name string, mtu int) (Device, error) {
|
|||
if err == nil && name == "utun" {
|
||||
fname := os.Getenv("WG_TUN_NAME_FILE")
|
||||
if fname != "" {
|
||||
os.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0400)
|
||||
os.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0o400)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +232,6 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
|
|||
}
|
||||
|
||||
func (tun *NativeTun) Write(buff []byte, offset int) (int, error) {
|
||||
|
||||
// reserve space for header
|
||||
|
||||
buff = buff[offset-4:]
|
||||
|
|
@ -282,7 +281,6 @@ func (tun *NativeTun) setMTU(n int) error {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -306,7 +304,6 @@ func (tun *NativeTun) MTU() (int, error) {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@ func (tun *NativeTun) setMTU(n int) error {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -269,7 +268,6 @@ func (tun *NativeTun) MTU() (int, error) {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ func CreateTUN(name string, mtu int) (Device, error) {
|
|||
if err == nil && name == "tun" {
|
||||
fname := os.Getenv("WG_TUN_NAME_FILE")
|
||||
if fname != "" {
|
||||
os.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0400)
|
||||
os.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0o400)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,6 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
|
|||
}
|
||||
|
||||
func (tun *NativeTun) Write(buff []byte, offset int) (int, error) {
|
||||
|
||||
// reserve space for header
|
||||
|
||||
buff = buff[offset-4:]
|
||||
|
|
@ -274,7 +273,6 @@ func (tun *NativeTun) setMTU(n int) error {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -309,7 +307,6 @@ func (tun *NativeTun) MTU() (int, error) {
|
|||
unix.SOCK_DGRAM,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ type NativeTun struct {
|
|||
forcedMTU int
|
||||
}
|
||||
|
||||
var WintunTunnelType = "WireGuard"
|
||||
var WintunStaticRequestedGUID *windows.GUID
|
||||
var (
|
||||
WintunTunnelType = "WireGuard"
|
||||
WintunStaticRequestedGUID *windows.GUID
|
||||
)
|
||||
|
||||
//go:linkname procyield runtime.procyield
|
||||
func procyield(cycles uint32)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue