2020-04-18 16:17:49 +07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ngoduykhanh/wireguard-ui/handler"
|
|
|
|
"github.com/ngoduykhanh/wireguard-ui/router"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := router.New()
|
|
|
|
|
2020-04-19 15:50:59 +07:00
|
|
|
app.GET("/", handler.WireGuardClients())
|
2020-04-18 16:17:49 +07:00
|
|
|
app.POST("/new-client", handler.NewClient())
|
2020-04-22 17:11:28 +07:00
|
|
|
app.POST("/client/set-status", handler.SetClientStatus())
|
2020-04-18 16:17:49 +07:00
|
|
|
app.POST("/remove-client", handler.RemoveClient())
|
2020-04-19 15:50:59 +07:00
|
|
|
app.GET("/wg-server", handler.WireGuardServer())
|
|
|
|
app.POST("wg-server/interfaces", handler.WireGuardServerInterfaces())
|
2020-04-20 00:15:25 +07:00
|
|
|
app.POST("wg-server/keypair", handler.WireGuardServerKeyPair())
|
2020-04-20 09:54:41 +07:00
|
|
|
app.GET("/global-settings", handler.GlobalSettings())
|
|
|
|
app.POST("/global-settings", handler.GlobalSettingSubmit())
|
2020-04-20 16:50:50 +07:00
|
|
|
app.GET("/api/machine-ips", handler.MachineIPAddresses())
|
2020-04-21 00:26:49 +07:00
|
|
|
app.GET("/api/suggest-client-ips", handler.SuggestIPAllocation())
|
2020-04-23 09:29:44 +07:00
|
|
|
app.GET("/api/apply-wg-config", handler.ApplyServerConfig())
|
2020-04-18 16:17:49 +07:00
|
|
|
app.Logger.Fatal(app.Start("127.0.0.1:5000"))
|
|
|
|
}
|