2021-04-28 16:15:45 +02:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2021-07-25 15:09:33 +02:00
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(serveCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
var serveCmd = &cobra.Command{
|
2021-04-28 16:15:45 +02:00
|
|
|
Use: "serve",
|
|
|
|
Short: "Launches the headscale server",
|
|
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
h, err := getHeadscaleApp()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error initializing: %s", err)
|
|
|
|
}
|
2021-05-23 02:15:29 +02:00
|
|
|
go h.ExpireEphemeralNodes(5000)
|
2021-04-28 16:15:45 +02:00
|
|
|
err = h.Serve()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error initializing: %s", err)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|