mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-15 04:48:10 -07:00
(untested) Merge commit e56ad81 from https://github.com/jzelinskie/chihaya
* rename/replace redis keys
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"net/netip"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
@@ -20,6 +21,18 @@ type Server struct {
|
||||
srv *http.Server
|
||||
}
|
||||
|
||||
// AddressFamily returns the label value for reporting the address family of an IP address.
|
||||
func AddressFamily(ip netip.Addr) string {
|
||||
switch {
|
||||
case ip.Is4(), ip.Is4In6():
|
||||
return "IPv4"
|
||||
case ip.Is6():
|
||||
return "IPv6"
|
||||
default:
|
||||
return "<unknown>"
|
||||
}
|
||||
}
|
||||
|
||||
// Stop shuts down the server.
|
||||
func (s *Server) Stop() stop.Result {
|
||||
c := make(stop.Channel)
|
||||
|
||||
Reference in New Issue
Block a user