go fmt
This commit is contained in:
parent
87317e374a
commit
a99449e960
@ -30,7 +30,7 @@ func main() {
|
||||
case "down":
|
||||
|
||||
default:
|
||||
help();
|
||||
help()
|
||||
}
|
||||
}
|
||||
|
||||
|
8
const.go
8
const.go
@ -7,13 +7,11 @@ const (
|
||||
// these end up in the config file
|
||||
DEFAULT_INTERFACE_NAME = "dsnet"
|
||||
DEFAULT_REPORT_FILE = "/var/lib/dsnet-report.json"
|
||||
DEFAULT_LISTEN_PORT = 51820;
|
||||
DEFAULT_LISTEN_PORT = 51820
|
||||
|
||||
// keepalive always configured for everything
|
||||
KEEPALIVE_SECONDS = 21;
|
||||
KEEPALIVE_SECONDS = 21
|
||||
|
||||
// when is a peer considered gone forever? (could remove)
|
||||
EXPIRY_DAYS = 28;
|
||||
|
||||
|
||||
EXPIRY_DAYS = 28
|
||||
)
|
||||
|
10
init.go
10
init.go
@ -1,12 +1,11 @@
|
||||
package dsnet
|
||||
|
||||
import (
|
||||
"net"
|
||||
"math/rand"
|
||||
"fmt"
|
||||
"time"
|
||||
"encoding/json"
|
||||
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"time"
|
||||
//"github.com/mikioh/ipaddr"
|
||||
)
|
||||
|
||||
@ -32,7 +31,6 @@ func Init() {
|
||||
}
|
||||
|
||||
// get a random /22 subnet on 10.0.0.0 (1023 hosts) (or /24?)
|
||||
// TODO also the 20 bit block and 16 bit block?
|
||||
func getRandomNetwork() JSONIPNet {
|
||||
rbs := make([]byte, 2)
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
|
6
types.go
6
types.go
@ -1,9 +1,9 @@
|
||||
package dsnet
|
||||
|
||||
import (
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"net"
|
||||
"time"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
)
|
||||
|
||||
// see https://github.com/WireGuard/wgctrl-go/blob/master/wgtypes/types.go for definitions
|
||||
@ -87,7 +87,7 @@ func (k JSONKey) MarshalJSON() ([]byte, error) {
|
||||
func GenerateJSONPrivateKey() JSONKey {
|
||||
privateKey, err := wgtypes.GeneratePrivateKey()
|
||||
|
||||
if (err != nil) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ func GenerateJSONPrivateKey() JSONKey {
|
||||
func GenerateJSONKey() JSONKey {
|
||||
privateKey, err := wgtypes.GenerateKey()
|
||||
|
||||
if (err != nil) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user