v0.2.0
ADDED: * The ability to show both IPv4 and IPv6 addresses (if the client has dual-stack and either the server does as well or a separate ClientInfo is running on the "other" net family).
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
`encoding/xml`
|
||||
`net`
|
||||
`net/http`
|
||||
`net/url`
|
||||
`os`
|
||||
"encoding/xml"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
`github.com/mileusna/useragent`
|
||||
`r00t2.io/clientinfo/args`
|
||||
`r00t2.io/goutils/logging`
|
||||
"github.com/mileusna/useragent"
|
||||
"r00t2.io/clientinfo/args"
|
||||
"r00t2.io/goutils/logging"
|
||||
)
|
||||
|
||||
type outerRenderer func(page *Page, resp http.ResponseWriter) (err error)
|
||||
type XmlHeaders map[string][]string
|
||||
type (
|
||||
outerRenderer func(page *Page, resp http.ResponseWriter) (err error)
|
||||
XmlHeaders map[string][]string
|
||||
)
|
||||
|
||||
// R00tInfo is the structure of data returned to the client.
|
||||
type R00tInfo struct {
|
||||
@@ -22,7 +25,7 @@ type R00tInfo struct {
|
||||
// Client is the UA/Client info, if any passed by the client.
|
||||
Client []*R00tClient `json:"ua,omitempty" xml:"ua,omitempty" yaml:"Client/User Agent,omitempty"`
|
||||
// IP is the client IP address.
|
||||
IP net.IP `json:"ip" xml:"ip,attr" yaml:"Client IP Address"`
|
||||
IP netip.Addr `json:"ip" xml:"ip,attr" yaml:"Client IP Address"`
|
||||
// Port is the client's port number.
|
||||
Port uint16 `json:"port" xml:"port,attr" yaml:"Client Port"`
|
||||
// Headers are the collection of the request headers sent by the client.
|
||||
@@ -84,19 +87,23 @@ type Page struct {
|
||||
Indent string
|
||||
// DoIndent indicates if indenting was enabled.
|
||||
DoIndent bool
|
||||
srv *Server
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
log logging.Logger
|
||||
args *args.Args
|
||||
listenUri *url.URL
|
||||
isHttp bool
|
||||
mux *http.ServeMux
|
||||
sock net.Listener
|
||||
doneChan chan bool
|
||||
stopChan chan os.Signal
|
||||
reloadChan chan os.Signal
|
||||
isStopping bool
|
||||
log logging.Logger
|
||||
args *args.Args
|
||||
listenUri *url.URL
|
||||
isHttp bool
|
||||
mux *http.ServeMux
|
||||
sock net.Listener
|
||||
doneChan chan bool
|
||||
stopChan chan os.Signal
|
||||
reloadChan chan os.Signal
|
||||
v4Url *url.URL
|
||||
v6Url *url.URL
|
||||
corsOrigins map[string]struct{}
|
||||
isStopping bool
|
||||
}
|
||||
|
||||
// https://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
|
||||
Reference in New Issue
Block a user