Compare commits

..

No commits in common. "master" and "v0.0.9" have entirely different histories.

4 changed files with 13 additions and 10 deletions

View File

@ -15,7 +15,7 @@ import (
//go:embed static //go:embed static
var staticFiles embed.FS var staticFiles embed.FS
func RunServer(bind string, port uint16) { func RunServer(port uint16) {
tpl, err := template.ParseFS(staticFiles, "static/*") tpl, err := template.ParseFS(staticFiles, "static/*")
if err != nil { if err != nil {
println(err.Error()) println(err.Error())
@ -41,9 +41,8 @@ func RunServer(bind string, port uint16) {
r.GET("/convert", handler.Convert) r.GET("/convert", handler.Convert)
address := bind + ":" + strconv.Itoa(int(port)) fmt.Println("Server is running on port", port)
fmt.Println("Server is running on", address) err = r.Run(":" + strconv.Itoa(int(port)))
err = r.Run(address)
if err != nil { if err != nil {
fmt.Println("Run server failed: ", err) fmt.Println("Run server failed: ", err)
} }

View File

@ -6,14 +6,10 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var ( var port uint16
port uint16
bind string
)
func init() { func init() {
runCmd.Flags().Uint16VarP(&port, "port", "p", 8080, "server port") runCmd.Flags().Uint16VarP(&port, "port", "p", 8080, "server port")
runCmd.Flags().StringVarP(&bind, "bind", "b", "0.0.0.0", "bind address (e.g., 0.0.0.0, 127.0.0.1, localhost)")
RootCmd.AddCommand(runCmd) RootCmd.AddCommand(runCmd)
} }
@ -22,6 +18,6 @@ var runCmd = &cobra.Command{
Long: "Run the server", Long: "Run the server",
Short: "Run the server", Short: "Run the server",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
api.RunServer(bind, port) api.RunServer(port)
}, },
} }

View File

@ -130,6 +130,10 @@
"rule_set": "geosite-google", "rule_set": "geosite-google",
"outbound": "default" "outbound": "default"
}, },
{
"rule_set": "geosite-bahamut",
"outbound": "台湾(TW)"
},
{ {
"process_path_regex": [ "process_path_regex": [
"^.+/steam/compatibilitytools.d/.+", "^.+/steam/compatibilitytools.d/.+",

View File

@ -130,6 +130,10 @@
"rule_set": "geosite-google", "rule_set": "geosite-google",
"outbound": "default" "outbound": "default"
}, },
{
"rule_set": "geosite-bahamut",
"outbound": "台湾(TW)"
},
{ {
"process_path_regex": [ "process_path_regex": [
"^.+/steam/compatibilitytools.d/.+", "^.+/steam/compatibilitytools.d/.+",