@@ -57,6 +57,8 @@ A simple UI interface is available to display network data.`,
displayStart(ll)
ctx := context.Background()
+ go handleStopSignals()
+
// Start the node to the network, using our ledger
if err := e.Start(ctx); err != nil {
return err
@@ -73,6 +73,7 @@ func DNS() cli.Command {
}
@@ -91,6 +91,7 @@ This is also the ID used to refer when receiving it.`,
if err := e.Start(context.Background()); err != nil {
@@ -139,6 +140,7 @@ func FileReceive() cli.Command {
@@ -38,6 +38,7 @@ Useful for setting up relays or hop nodes to improve the network connectivity.`,
@@ -219,7 +219,7 @@ func Main() func(c *cli.Context) error {
if c.Bool("api") {
go api.API(ctx, c.String("api-listen"), 5*time.Second, 20*time.Second, e, bwc, c.Bool("debug"))
-
return e.Start(ctx)
@@ -74,6 +74,8 @@ func Proxy() cli.Command {
@@ -86,6 +86,7 @@ For example, '192.168.1.1:80', or '127.0.0.1:22'.`,
// Join the node to the network, using our ledger
@@ -148,6 +149,7 @@ to the service over the network`,
// starts the node
return e.Start(context.Background())
@@ -17,7 +17,10 @@ package cmd
import (
"encoding/json"
+ "os"
+ "os/signal"
"runtime"
+ "syscall"
"time"
"github.com/ipfs/go-log"
@@ -480,3 +483,12 @@ func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *logger.Logger) {
return nodeOpts, vpnOpts, llger
+func handleStopSignals() {
+ s := make(chan os.Signal, 10)
+ signal.Notify(s, os.Interrupt, syscall.SIGTERM)
+ for range s {
+ os.Exit(0)
+ }
+}