check peer exists before removal

This commit is contained in:
Callan Bryant 2020-03-08 19:08:19 +00:00
parent 4fd8d5f99d
commit cf467c346b
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
2 changed files with 3 additions and 3 deletions

View File

@ -32,5 +32,6 @@ TODO after first release:
* Hooks for adding routes/ IPtables forwarding rules * Hooks for adding routes/ IPtables forwarding rules
* Route entire internet option * Route entire internet option
* Support for additional subnets in peer config (with routes) * Support for additional subnets in peer config (with routes) in separate networks section in report
* Peer endpoint support * Peer endpoint support
* Decide what to do with assumed default DNS server

View File

@ -10,11 +10,10 @@ func Remove() {
ExitFail("Hostname argument required: dsnet remove <hostname>") ExitFail("Hostname argument required: dsnet remove <hostname>")
} }
ConfirmOrAbort("Do you really want to remove %s?", os.Args[2])
conf := MustLoadDsnetConfig() conf := MustLoadDsnetConfig()
hostname := os.Args[2] hostname := os.Args[2]
conf.MustRemovePeer(hostname) conf.MustRemovePeer(hostname)
ConfirmOrAbort("Do you really want to remove %s?", os.Args[2])
conf.MustSave() conf.MustSave()
ConfigureDevice(conf) ConfigureDevice(conf)
} }