error() check
This commit is contained in:
parent
3f52a08392
commit
2c3bb65612
10
README.md
10
README.md
@ -11,7 +11,7 @@ helper.
|
|||||||
Creates the config file /etc/dsnet.json defining subnet, creating private key,
|
Creates the config file /etc/dsnet.json defining subnet, creating private key,
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
`dsnet up`
|
`dsnet sync`
|
||||||
Loads peers from JSON file /etc/dsnet.json and brings the interface online. If
|
Loads peers from JSON file /etc/dsnet.json and brings the interface online. If
|
||||||
interface is already online, synchronises peers by adding/removing. Interface
|
interface is already online, synchronises peers by adding/removing. Interface
|
||||||
name in file, dsnet. Runs commands to add routes/forwarding/whatever.
|
name in file, dsnet. Runs commands to add routes/forwarding/whatever.
|
||||||
@ -20,9 +20,9 @@ name in file, dsnet. Runs commands to add routes/forwarding/whatever.
|
|||||||
Brings the interface down after disassociating all peers.
|
Brings the interface down after disassociating all peers.
|
||||||
|
|
||||||
`dsnet add`
|
`dsnet add`
|
||||||
Add a peer by name. Returns a config file as QR code or file. If public key is
|
Add a peer by name. Returns a config file as QR code or file as specified. If
|
||||||
specified, private key won't be generated. Editing/removing a peer can be done
|
public key is specified, private key won't be generated. Editing/removing a
|
||||||
by editing the JSON file.
|
peer can be done by editing the JSON file.
|
||||||
|
|
||||||
QR code + confirmation prompt on stderr, peer info on stdout.
|
QR code + confirmation prompt on stderr, peer info on stdout.
|
||||||
|
|
||||||
@ -36,4 +36,4 @@ etc. The JSON is intended to be consumed by a hugo template as a data source.
|
|||||||
Could also be updated via XHR/websockets.
|
Could also be updated via XHR/websockets.
|
||||||
|
|
||||||
Report is intended to be generated every minute by cron running as root. The
|
Report is intended to be generated every minute by cron running as root. The
|
||||||
webserver can then read the file. Location /var/lib/dsnet-info.json
|
webserver can then read the file. Location /var/lib/dsnet-report.json
|
||||||
|
8
types.go
8
types.go
@ -88,9 +88,7 @@ func (k JSONKey) MarshalJSON() ([]byte, error) {
|
|||||||
func GenerateJSONPrivateKey() JSONKey {
|
func GenerateJSONPrivateKey() JSONKey {
|
||||||
privateKey, err := wgtypes.GeneratePrivateKey()
|
privateKey, err := wgtypes.GeneratePrivateKey()
|
||||||
|
|
||||||
if err != nil {
|
check(err)
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return JSONKey{
|
return JSONKey{
|
||||||
Key: privateKey,
|
Key: privateKey,
|
||||||
@ -100,9 +98,7 @@ func GenerateJSONPrivateKey() JSONKey {
|
|||||||
func GenerateJSONKey() JSONKey {
|
func GenerateJSONKey() JSONKey {
|
||||||
privateKey, err := wgtypes.GenerateKey()
|
privateKey, err := wgtypes.GenerateKey()
|
||||||
|
|
||||||
if err != nil {
|
check(err)
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return JSONKey{
|
return JSONKey{
|
||||||
Key: privateKey,
|
Key: privateKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user