Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientCommand = &cli.Command{ Name: "client", Usage: "NodeISP Management Client", Commands: ClientCommands, }
View Source
var ClientCommands = []*cli.Command{ { Name: "status", Usage: "Get the current status of the NodeISP server", Action: client.StatusCmd, }, { Name: "version", Usage: "Get the current version and check for updates", Action: client.VersionCmd, }, { Name: "update", Usage: "Update the NodeISP server", Action: client.UpdateCmd, }, { Name: "restart", Usage: "Restart the NodeISP server", Commands: []*cli.Command{ { Name: "all", Usage: "Restart all services", Action: client.RestartAllCmd, }, { Name: "service", Usage: "Restart a specific service", ArgsUsage: "<service>", Action: client.RestartServiceCmd, }, }, }, }
View Source
var ConfigFlag = &cli.StringFlag{ Name: "config", Aliases: []string{"c"}, Usage: "Load configuration from `FILE`", Sources: cli.EnvVars("NODEISP_CONFIG"), Value: "/etc/node-isp/config.yaml", Destination: &config.File, }
View Source
var RadiusCommand = &cli.Command{ Name: "radius", Usage: "Radius server management", Flags: []cli.Flag{ &cli.StringFlag{ Name: "domain", Usage: "The domain of the Node ISP Instance", Destination: &domain, Required: true, Sources: cli.EnvVars("NODE_ISP_DOMAIN"), }, &cli.StringFlag{ Name: "token", Usage: "The Radius Server Token from the Node ISP Instance", Destination: &token, Required: true, Sources: cli.EnvVars("NODE_ISP_RADIUS_TOKEN"), }, &cli.StringFlag{ Name: "cache-dir", Usage: "The directory to store the cache file in", Destination: &cacheDir, Value: "/var/lib/nodeisp/radius", Sources: cli.EnvVars("NODE_ISP_RADIUS_CACHE_DIR"), }, &cli.BoolFlag{ Name: "insecure", Usage: "Allow insecure connections", Destination: &insecure, Value: false, Sources: cli.EnvVars("NODE_ISP_RADIUS_INSECURE"), }, }, Action: func(ctx context.Context, command *cli.Command) error { url := fmt.Sprintf("wss://%s/_internal/realtime", domain) if insecure { url = fmt.Sprintf("ws://%s/_internal/realtime", domain) } return radius.Run( url, token, cacheDir, ) }, }
View Source
var RealtimeServerCommand = &cli.Command{ Name: "realtime", Usage: "NodeISP Standalone Realtime Server", Description: "The RealTime server is mainly needed for Radius development, and run's only the RealTime server from NodeISP.", Flags: []cli.Flag{ &cli.StringFlag{ Name: "backend-domain", Usage: "The URL of the backend server", Destination: &backendDomain, Required: true, }, }, Action: func(ctx context.Context, cmd *cli.Command) error { rt := &realtime.RealTime{ BackendUrl: fmt.Sprintf("https://%s/api/centrifugo", backendDomain), Log: log.WithField("component", "realtime"), } mux := http.NewServeMux() mux.HandleFunc("/_internal/realtime", rt.Handler) go func() { if err := http.ListenAndServe("127.0.0.1:9998", mux); err != nil { rt.Log.WithError(err).Fatal("Failed to start RealTime HTTP server") } }() if err := rt.Run(); err != nil { rt.Log.WithError(err).Fatal("Failed to start RealTime WS server") } rt.Log.Info("RealTime server started") select {} }, }
View Source
var RootCommand = &cli.Command{ Name: "node-isp", Usage: "Building blocks for your own ISP", Version: version.Version, Flags: []cli.Flag{ ConfigFlag, }, Commands: append([]*cli.Command{ SetupCommand, ServerCommand, RealtimeServerCommand, RadiusCommand, }, ClientCommands...), }
View Source
var ServerCommand = &cli.Command{ Name: "server", Usage: "NodeISP Server", Action: func(ctx context.Context, cmd *cli.Command) error { _, err := os.Stat(config.File) if os.IsNotExist(err) { c := SetupCommand c.Flags = append(c.Flags, ConfigFlag) return SetupCommand.Run(ctx, os.Args) } return server.Run() }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.