mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-25 01:14:42 -05:00
23 lines
376 B
Go
23 lines
376 B
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strconv"
|
||
|
"sub2sing-box/api/handler"
|
||
|
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func RunServer(port uint16) {
|
||
|
gin.SetMode(gin.ReleaseMode)
|
||
|
r := gin.Default()
|
||
|
|
||
|
r.GET("/convert", handler.Convert)
|
||
|
|
||
|
fmt.Println("Server is running on port ", port)
|
||
|
err := r.Run(":" + strconv.Itoa(int(port)))
|
||
|
if err != nil {
|
||
|
fmt.Println("Run server failed: ", err)
|
||
|
}
|
||
|
}
|