feat: api server

This commit is contained in:
2024-03-12 01:34:08 +08:00
parent 02a9fd5a1c
commit 54d6eb0f75
8 changed files with 298 additions and 79 deletions

23
cmd/server.go Normal file
View 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)
},
}