mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 17:50:12 +00:00
feat(agentcompat): add dashboard listener hooks
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
+11
-3
@@ -8,7 +8,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
@@ -140,10 +139,18 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", singleton.Conf.ListenHost, singleton.Conf.ListenPort))
|
||||
l, err := openDashboardListener("tcp", dashboardListenerAddress(singleton.Conf.ListenHost, singleton.Conf.ListenPort), dashboardHTTPListener)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
receiptListener, err := openReceiptGateListener()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if receiptListener != nil {
|
||||
defer receiptListener.Close()
|
||||
rpc.SetReceiptGateListener(receiptListener)
|
||||
}
|
||||
|
||||
singleton.CleanMonitorHistory()
|
||||
rpc.DispatchKeepalive()
|
||||
@@ -185,7 +192,7 @@ func main() {
|
||||
log.Printf("NEZHA>> Dashboard::START ON %s:%d", singleton.Conf.ListenHost, singleton.Conf.ListenPort)
|
||||
if singleton.Conf.HTTPS.ListenPort != 0 {
|
||||
go func() {
|
||||
errChan <- muxServerHTTPS.ListenAndServeTLS(singleton.Conf.HTTPS.TLSCertPath, singleton.Conf.HTTPS.TLSKeyPath)
|
||||
errChan <- serveDashboardHTTPS(muxServerHTTPS, singleton.Conf.HTTPS.TLSCertPath, singleton.Conf.HTTPS.TLSKeyPath)
|
||||
}()
|
||||
log.Printf("NEZHA>> Dashboard::START ON %s:%d", singleton.Conf.ListenHost, singleton.Conf.HTTPS.ListenPort)
|
||||
}
|
||||
@@ -195,6 +202,7 @@ func main() {
|
||||
return <-errChan
|
||||
}, func(c context.Context) error {
|
||||
log.Println("NEZHA>> Graceful::START")
|
||||
rpc.CloseReceiptGate()
|
||||
singleton.RecordTransferHourlyUsage()
|
||||
singleton.CloseTSDB()
|
||||
log.Println("NEZHA>> Graceful::END")
|
||||
|
||||
Reference in New Issue
Block a user