start peer conf file, update README

This commit is contained in:
Callan Bryant 2020-03-02 19:57:52 +00:00
parent 8baaa06d84
commit 19668c0334
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
3 changed files with 25 additions and 7 deletions

View File

@ -1,8 +1,4 @@
Purpose: to allow an overview of Darksky peers and provide a mechanism to allow dsnet is a simple tool to manage a wireguard VPN. Think wg-quick but quicker.
easy joining
dsnet is a simple tool to manage a wireguard VPN.
Usage: dsnet <cmd> Usage: dsnet <cmd>
@ -19,3 +15,10 @@ dsnet is a simple tool to manage a wireguard VPN.
To send configurations, ffsend (with separately transferred password) or a local QR code generator may be used. To send configurations, ffsend (with separately transferred password) or a local QR code generator may be used.
TODO after first release:
* Hooks for adding routes/ IPtables forwarding rules
* Forward option
* Support for additional subnets in peer config
* Peer endpoint support

16
add.go
View File

@ -19,7 +19,6 @@ func Add(hostname string, owner string, description string) { //, publicKey stri
Description: description, Description: description,
PublicKey: publicKey, PublicKey: publicKey,
PresharedKey: presharedKey, PresharedKey: presharedKey,
// TODO Endpoint:
AllowedIPs: []JSONIPNet{ AllowedIPs: []JSONIPNet{
JSONIPNet{ JSONIPNet{
IPNet: net.IPNet{ IPNet: net.IPNet{
@ -33,3 +32,18 @@ func Add(hostname string, owner string, description string) { //, publicKey stri
conf.MustAddPeer(peer) conf.MustAddPeer(peer)
conf.MustSave() conf.MustSave()
} }
func GetPeerWgQuickConf(peer PeerConfig, privKey JSONKey) string {
return `[Interface]
Address = 10.50.60.2/24
PrivateKey=REDACTED
DNS = 8.8.8.8
[Peer]
PublicKey=cAR+SMd+yvGw2TVzVSRoLtxF5TLA2Y/ceebO8ZAyITw=
Endpoint=3.9.82.135:51820
AllowedIPs=0.0.0.0/0
PersistentKeepalive=21
`
}

View File

@ -39,7 +39,8 @@ type Peer struct {
PublicKey wgtypes.Key PublicKey wgtypes.Key
PresharedKey wgtypes.Key PresharedKey wgtypes.Key
Endpoint *net.UDPAddr // TODO peer endpoint support
//Endpoint *net.UDPAddr
LastHandshakeTime time.Time LastHandshakeTime time.Time
ReceiveBytes int64 ReceiveBytes int64
TransmitBytes int64 TransmitBytes int64