mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
go code autoformat
This commit is contained in:
parent
316a202c8f
commit
2cc402237e
10 changed files with 8 additions and 15 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
//"github.com/RiV-chain/RiV-mesh/src/address"
|
//"github.com/RiV-chain/RiV-mesh/src/address"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
//"github.com/RiV-chain/RiV-mesh/src/address"
|
//"github.com/RiV-chain/RiV-mesh/src/address"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
//"github.com/RiV-chain/RiV-mesh/src/address"
|
//"github.com/RiV-chain/RiV-mesh/src/address"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
//"github.com/RiV-chain/RiV-mesh/src/address"
|
//"github.com/RiV-chain/RiV-mesh/src/address"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,6 @@ func (l *linkTCP) dialerFor(dst *net.TCPAddr, sintf string) (*net.Dialer, error)
|
||||||
return dialer, nil
|
return dialer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func tcpIDFor(local net.Addr, remoteAddr *net.TCPAddr) string {
|
func tcpIDFor(local net.Addr, remoteAddr *net.TCPAddr) string {
|
||||||
if localAddr, ok := local.(*net.TCPAddr); ok && localAddr.IP.Equal(remoteAddr.IP) {
|
if localAddr, ok := local.(*net.TCPAddr); ok && localAddr.IP.Equal(remoteAddr.IP) {
|
||||||
// Nodes running on the same host — include both the IP and port.
|
// Nodes running on the same host — include both the IP and port.
|
||||||
|
|
|
@ -11,7 +11,6 @@ import (
|
||||||
|
|
||||||
iwt "github.com/Arceliar/ironwood/types"
|
iwt "github.com/Arceliar/ironwood/types"
|
||||||
"github.com/Arceliar/phony"
|
"github.com/Arceliar/phony"
|
||||||
|
|
||||||
//"github.com/RiV-chain/RiV-mesh/src/address"
|
//"github.com/RiV-chain/RiV-mesh/src/address"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
package multicast
|
package multicast
|
||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ func (m *Multicast) multicastReuse(network string, address string, c syscall.Raw
|
||||||
var reuseaddr error
|
var reuseaddr error
|
||||||
|
|
||||||
control = c.Control(func(fd uintptr) {
|
control = c.Control(func(fd uintptr) {
|
||||||
// Previously we used SO_REUSEPORT here, but that meant that machines running
|
// Previously we used SO_REUSEPORT here, but that meant that machines running
|
||||||
// RiV-mesh nodes as different users would inevitably fail with EADDRINUSE.
|
// RiV-mesh nodes as different users would inevitably fail with EADDRINUSE.
|
||||||
// The behaviour for multicast is similar with both, so we'll use SO_REUSEADDR
|
// The behaviour for multicast is similar with both, so we'll use SO_REUSEADDR
|
||||||
// instead.
|
// instead.
|
||||||
if reuseaddr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1); reuseaddr != nil {
|
if reuseaddr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1); reuseaddr != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Failed to set SO_REUSEADDR on socket: %s\n", reuseaddr)
|
fmt.Fprintf(os.Stderr, "Failed to set SO_REUSEADDR on socket: %s\n", reuseaddr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ func MaximumMTU() uint64 {
|
||||||
func New(core *core.Core, log core.Logger, opts ...SetupOption) (*TunAdapter, error) {
|
func New(core *core.Core, log core.Logger, opts ...SetupOption) (*TunAdapter, error) {
|
||||||
tun := &TunAdapter{
|
tun := &TunAdapter{
|
||||||
core: core,
|
core: core,
|
||||||
rwc: ipv6rwc.NewReadWriteCloser(core),
|
rwc: ipv6rwc.NewReadWriteCloser(core),
|
||||||
log: log,
|
log: log,
|
||||||
}
|
}
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
tun._applyOption(opt)
|
tun._applyOption(opt)
|
||||||
|
|
|
@ -6,9 +6,9 @@ package tun
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/RiV-chain/RiV-mesh/src/defaults"
|
"github.com/RiV-chain/RiV-mesh/src/defaults"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
@ -43,7 +43,7 @@ func (tun *TunAdapter) setup(ifname string, addr string, mtu uint64) error {
|
||||||
if i > 8 {
|
if i > 8 {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
time.Sleep(time.Duration(2 * i) * time.Second)
|
time.Sleep(time.Duration(2*i) * time.Second)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue