mirror of
https://github.com/bestnite/sub2sing-box.git
synced 2025-06-18 11:03:18 +08:00
feat: api server
This commit is contained in:
23
cmd/server.go
Normal file
23
cmd/server.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"sub2sing-box/api"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var port uint16
|
||||
|
||||
func init() {
|
||||
runCmd.Flags().Uint16VarP(&port, "port", "p", 8080, "server port")
|
||||
RootCmd.AddCommand(runCmd)
|
||||
}
|
||||
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Long: "Run the server",
|
||||
Short: "Run the server",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
api.RunServer(port)
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user