goku-ce-admin.go 3.9 KB
Newer Older
E
V2.1.0  
eoLinker API Management 已提交
1 2 3 4 5 6
package main

import (
	"fmt"
	_ "goku-ce/server/conf"
	"goku-ce/server/controller"
E
eoLinker API Management 已提交
7
	"net/http"
E
V2.1.0  
eoLinker API Management 已提交
8 9 10
)

func main() {
E
eoLinker API Management 已提交
11

E
V2.1.0  
eoLinker API Management 已提交
12
	// 游客
E
eoLinker API Management 已提交
13 14
	http.HandleFunc("/Web/Guest/login", controller.Login)

E
V2.1.0  
eoLinker API Management 已提交
15
	// 用户
E
eoLinker API Management 已提交
16 17
	http.HandleFunc("/Web/User/checkLogin", controller.CheckLogin)
	http.HandleFunc("/Web/User/logout", controller.Logout)
E
V2.1.0  
eoLinker API Management 已提交
18 19

	// 网关
E
eoLinker API Management 已提交
20 21 22 23 24 25
	http.HandleFunc("/Web/Gateway/addGateway", controller.AddGateway)
	http.HandleFunc("/Web/Gateway/editGateway", controller.EditGateway)
	http.HandleFunc("/Web/Gateway/deleteGateway", controller.DeleteGateway)
	http.HandleFunc("/Web/Gateway/getGatewayList", controller.GetGatewayList)
	http.HandleFunc("/Web/Gateway/getGateway", controller.GetGatewayInfo)
	http.HandleFunc("/Web/Gateway/checkGatewayAliasIsExist", controller.CheckGatewayAliasIsExist)
E
V2.1.0  
eoLinker API Management 已提交
26 27

	//网关服务
E
eoLinker API Management 已提交
28 29 30 31
	http.HandleFunc("/Web/GatewayService/restart", controller.RestartGatewayService)
	http.HandleFunc("/Web/GatewayService/reload", controller.ReloadGatewayService)
	http.HandleFunc("/Web/GatewayService/stop", controller.StopGatewayService)
	http.HandleFunc("/Web/GatewayService/start", controller.StartGatewayService)
E
V2.1.0  
eoLinker API Management 已提交
32 33

	// 后端服务
E
eoLinker API Management 已提交
34 35 36 37 38
	http.HandleFunc("/Web/Backend/addBackend", controller.AddBackend)
	http.HandleFunc("/Web/Backend/editBackend", controller.EditBackend)
	http.HandleFunc("/Web/Backend/deleteBackend", controller.DeleteBackend)
	http.HandleFunc("/Web/Backend/getBackendList", controller.GetBackendList)
	http.HandleFunc("/Web/Backend/getBackend", controller.GetBackendInfo)
E
V2.1.0  
eoLinker API Management 已提交
39 40

	// API分组
E
eoLinker API Management 已提交
41 42 43 44
	http.HandleFunc("/Web/ApiGroup/addGroup", controller.AddApiGroup)
	http.HandleFunc("/Web/ApiGroup/editGroup", controller.EditApiGroup)
	http.HandleFunc("/Web/ApiGroup/deleteGroup", controller.DeleteApiGroup)
	http.HandleFunc("/Web/ApiGroup/getGroupList", controller.GetApiGroupList)
E
V2.1.0  
eoLinker API Management 已提交
45 46

	// API
E
eoLinker API Management 已提交
47 48 49 50 51 52 53 54
	http.HandleFunc("/Web/Api/addApi", controller.AddApi)
	http.HandleFunc("/Web/Api/editApi", controller.EditApi)
	http.HandleFunc("/Web/Api/deleteApi", controller.DeleteApi)
	http.HandleFunc("/Web/Api/getApi", controller.GetApiInfo)
	http.HandleFunc("/Web/Api/searchApi", controller.SearchApi)
	http.HandleFunc("/Web/Api/getAllApiList", controller.GetAllApiList)
	http.HandleFunc("/Web/Api/getApiList", controller.GetApiListByGroup)
	http.HandleFunc("/Web/Api/checkApiURLIsExist", controller.CheckApiURLIsExist)
E
V2.1.0  
eoLinker API Management 已提交
55 56

	// 策略组
E
eoLinker API Management 已提交
57 58 59 60 61
	http.HandleFunc("/Web/Strategy/addStrategy", controller.AddStrategy)
	http.HandleFunc("/Web/Strategy/editStrategy", controller.EditStrategy)
	http.HandleFunc("/Web/Strategy/deleteStrategy", controller.DeleteStrategy)
	http.HandleFunc("/Web/Strategy/getStrategyList", controller.GetStrategyList)
	http.HandleFunc("/Web/Strategy/getSimpleStrategyList", controller.GetSimpleStrategyList)
E
V2.1.0  
eoLinker API Management 已提交
62 63

	// 流控
E
eoLinker API Management 已提交
64 65 66 67 68
	http.HandleFunc("/Web/RateLimit/addRateLimit", controller.AddRateLimit)
	http.HandleFunc("/Web/RateLimit/editRateLimit", controller.EditRateLimit)
	http.HandleFunc("/Web/RateLimit/deleteRateLimit", controller.DeleteRateLimit)
	http.HandleFunc("/Web/RateLimit/getRateLimitInfo", controller.GetRateLimitInfo)
	http.HandleFunc("/Web/RateLimit/getRateLimitList", controller.GetRateLimitList)
E
V2.1.0  
eoLinker API Management 已提交
69 70

	// 鉴权
E
eoLinker API Management 已提交
71 72
	http.HandleFunc("/Web/Auth/editAuth", controller.EditAuth)
	http.HandleFunc("/Web/Auth/getAuthInfo", controller.GetAuthInfo)
E
V2.1.0  
eoLinker API Management 已提交
73 74

	// 黑白名单
E
eoLinker API Management 已提交
75 76 77 78
	http.HandleFunc("/Web/IP/editGatewayIPList", controller.EditGatewayIPList)
	http.HandleFunc("/Web/IP/editStrategyIPList", controller.EditStrategyIPList)
	http.HandleFunc("/Web/IP/getGatewayIPList", controller.GetGatewayIPList)
	http.HandleFunc("/Web/IP/getStrategyIPList", controller.GetStrategyIPList)
E
V2.1.0  
eoLinker API Management 已提交
79 80

	// 安装
E
eoLinker API Management 已提交
81 82
	http.HandleFunc("/Web/Install/install", controller.Install)
	http.HandleFunc("/Web/Install/checkIsInstall", controller.CheckIsInstall)
E
V2.1.0  
eoLinker API Management 已提交
83 84

	// 全局配置
E
eoLinker API Management 已提交
85 86
	http.HandleFunc("/Web/Global/getConfInfo", controller.GetGlobalConfig)
	http.HandleFunc("/Web/Global/editConfInfo", controller.EditGlobalConfig)
E
V2.1.0  
eoLinker API Management 已提交
87 88

	fmt.Println("Listen: 9900")
E
eoLinker API Management 已提交
89 90 91 92 93 94
	err := http.ListenAndServe(":9900", nil)

	if err != nil {
		panic(err)
	}
}