mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 18:41:59 -07:00
Fix units
This commit is contained in:
parent
ce1a5cd2ce
commit
c00e26be81
@ -38,6 +38,7 @@ var (
|
|||||||
|
|
||||||
statusAddr string
|
statusAddr string
|
||||||
poolAddrs string
|
poolAddrs string
|
||||||
|
pools []string
|
||||||
providedBy string
|
providedBy string
|
||||||
defaultPoolAddrs string = "https://relays.syncthing.net/endpoint"
|
defaultPoolAddrs string = "https://relays.syncthing.net/endpoint"
|
||||||
)
|
)
|
||||||
@ -116,7 +117,7 @@ func main() {
|
|||||||
go statusService(statusAddr)
|
go statusService(statusAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s&providedBy=%s", extAddress, id, pingInterval, networkTimeout, sessionLimitBps, globalLimitBps, statusAddr, providedBy))
|
uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s&providedBy=%s", extAddress, id, pingInterval/time.Second, networkTimeout/time.Second, sessionLimitBps, globalLimitBps, statusAddr, providedBy))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Failed to construct URI", err)
|
log.Fatalln("Failed to construct URI", err)
|
||||||
}
|
}
|
||||||
@ -130,7 +131,7 @@ func main() {
|
|||||||
log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
}
|
}
|
||||||
|
|
||||||
pools := strings.Split(poolAddrs, ",")
|
pools = strings.Split(poolAddrs, ",")
|
||||||
for _, pool := range pools {
|
for _, pool := range pools {
|
||||||
pool = strings.TrimSpace(pool)
|
pool = strings.TrimSpace(pool)
|
||||||
if len(pool) > 0 {
|
if len(pool) > 0 {
|
||||||
|
@ -26,7 +26,7 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
|
|||||||
sessionMut.Lock()
|
sessionMut.Lock()
|
||||||
// This can potentially be double the number of pending sessions, as each session has two keys, one for each side.
|
// This can potentially be double the number of pending sessions, as each session has two keys, one for each side.
|
||||||
status["startTime"] = rc.startTime
|
status["startTime"] = rc.startTime
|
||||||
status["uptime"] = time.Since(rc.startTime)
|
status["uptimeSeconds"] = time.Since(rc.startTime) / time.Second
|
||||||
status["numPendingSessionKeys"] = len(pendingSessions)
|
status["numPendingSessionKeys"] = len(pendingSessions)
|
||||||
status["numActiveSessions"] = len(activeSessions)
|
status["numActiveSessions"] = len(activeSessions)
|
||||||
sessionMut.Unlock()
|
sessionMut.Unlock()
|
||||||
@ -46,12 +46,12 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
|
|||||||
rc.rate(60*60/10) * 8 / 1000,
|
rc.rate(60*60/10) * 8 / 1000,
|
||||||
}
|
}
|
||||||
status["options"] = map[string]interface{}{
|
status["options"] = map[string]interface{}{
|
||||||
"network-timeout": networkTimeout,
|
"network-timeout": networkTimeout / time.Second,
|
||||||
"ping-interval": pingInterval,
|
"ping-interval": pingInterval / time.Second,
|
||||||
"message-timeout": messageTimeout,
|
"message-timeout": messageTimeout / time.Second,
|
||||||
"per-session-rate": sessionLimitBps,
|
"per-session-rate": sessionLimitBps,
|
||||||
"global-rate": globalLimitBps,
|
"global-rate": globalLimitBps,
|
||||||
"pools": defaultPoolAddrs,
|
"pools": pools,
|
||||||
"provided-by": providedBy,
|
"provided-by": providedBy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user