admin.go 523 字节
Newer Older
Y
Your Name 已提交
1 2 3 4
package server

import (
	"log"
Y
Your Name 已提交
5
	"net/http"
Y
Your Name 已提交
6 7
	"sync"

Y
Your Name 已提交
8
	//"github.com/eolinker/goku-api-gateway/common/endless"
Y
Your Name 已提交
9 10 11

	"github.com/eolinker/goku-api-gateway/node/admin"
)
Y
Your Name 已提交
12

Y
Your Name 已提交
13 14 15
var (
	adminOnce = sync.Once{}
)
Y
Your Name 已提交
16

Y
Your Name 已提交
17 18
//StartAdmin 启动节点管理端
func StartAdmin(address string) {
Y
Your Name 已提交
19
	go adminOnce.Do(func() {
Y
Your Name 已提交
20 21 22 23
		//server := endless.NewServer(address, admin.Handler())
		//endless.SetAdminServer(server)
		//err := server.ListenAndServe()
		err := http.ListenAndServe(address, admin.Handler())
Y
Your Name 已提交
24
		if err != nil {
Y
Your Name 已提交
25 26 27 28
			log.Fatal(err)
		}
	})
}