mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-07 16:04:00 +01:00
Fix bug: HttpServer MultiListen
This commit is contained in:
parent
64a08ebe1e
commit
3bd54ceb58
@ -939,7 +939,7 @@ func manage_peerdel(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("NodeID: " + toDelete.ToString() + " deleted."))
|
||||
}
|
||||
|
||||
func HttpServer(edgeListen string, manageListen string, apiprefix string) (err error) {
|
||||
func HttpServer(edgeListen string, manageListen string, apiprefix string, errchan chan error) {
|
||||
if len(apiprefix) > 0 && apiprefix[0] != '/' {
|
||||
apiprefix = "/" + apiprefix
|
||||
}
|
||||
@ -960,7 +960,13 @@ func HttpServer(edgeListen string, manageListen string, apiprefix string) (err e
|
||||
mux.HandleFunc(apiprefix+"/manage/peer/update", manage_peerupdate)
|
||||
mux.HandleFunc(apiprefix+"/manage/super/state", manage_get_peerstate)
|
||||
mux.HandleFunc(apiprefix+"/manage/super/update", manage_superupdate)
|
||||
err = http.ListenAndServe(edgeListen, mux)
|
||||
|
||||
go func() {
|
||||
err := http.ListenAndServe(edgeListen, mux)
|
||||
if err != nil {
|
||||
errchan <- err
|
||||
}
|
||||
}()
|
||||
return
|
||||
} else {
|
||||
edgemux := http.NewServeMux()
|
||||
@ -974,14 +980,22 @@ func HttpServer(edgeListen string, manageListen string, apiprefix string) (err e
|
||||
managemux.HandleFunc(apiprefix+"/manage/peer/update", manage_peerupdate)
|
||||
managemux.HandleFunc(apiprefix+"/manage/super/state", manage_get_peerstate)
|
||||
managemux.HandleFunc(apiprefix+"/manage/super/update", manage_superupdate)
|
||||
err = http.ListenAndServe(edgeListen, edgemux)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
err := http.ListenAndServe(edgeListen, edgemux)
|
||||
if err != nil {
|
||||
errchan <- err
|
||||
}
|
||||
}()
|
||||
|
||||
if manageListen != "" {
|
||||
err = http.ListenAndServe(manageListen, managemux)
|
||||
go func() {
|
||||
err := http.ListenAndServe(manageListen, managemux)
|
||||
if err != nil {
|
||||
errchan <- err
|
||||
}
|
||||
}()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -204,10 +204,7 @@ func Super(configPath string, useUAPI bool, printExample bool, bindmode string)
|
||||
go Event_server_event_hendler(httpobj.http_graph, httpobj.http_super_chains)
|
||||
go RoutinePushSettings(mtypes.S2TD(sconfig.RePushConfigInterval))
|
||||
go RoutineTimeoutCheck()
|
||||
err = HttpServer(sconfig.ListenPort_EdgeAPI, sconfig.ListenPort_ManageAPI, sconfig.API_Prefix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
HttpServer(sconfig.ListenPort_EdgeAPI, sconfig.ListenPort_ManageAPI, sconfig.API_Prefix, errs)
|
||||
|
||||
if sconfig.PostScript != "" {
|
||||
envs := make(map[string]string)
|
||||
|
Loading…
Reference in New Issue
Block a user