mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2024-12-22 06:18:01 +00:00
Fix long lines (#2)
Using [golines](https://github.com/segmentio/golines): `golines -w .`
This commit is contained in:
parent
126ae833b5
commit
1aa59f1b0b
@ -112,7 +112,8 @@ func runTLSServer() {
|
||||
|
||||
go func() {
|
||||
log.Printf("Starting TLS server listening on %s", setting.App.TLSAddress)
|
||||
if err := tlsServer.ListenAndServeTLS(setting.App.TLSCrtPath, setting.App.TLSKeyPath); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
if err := tlsServer.ListenAndServeTLS(setting.App.TLSCrtPath, setting.App.TLSKeyPath); err != nil &&
|
||||
!errors.Is(err, http.ErrServerClosed) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Printf("Stopping TLS server...")
|
||||
|
@ -36,11 +36,23 @@ func Setup() {
|
||||
city := flag.String("geoip2-city", "", "Path to GeoIP2 city database")
|
||||
asn := flag.String("geoip2-asn", "", "Path to GeoIP2 ASN database")
|
||||
template := flag.String("template", "", "Path to template file")
|
||||
address := flag.String("bind", defaultAddress, "Listening address (see https://pkg.go.dev/net?#Listen)")
|
||||
addressTLS := flag.String("tls-bind", "", "Listening address for TLS (see https://pkg.go.dev/net?#Listen)")
|
||||
address := flag.String(
|
||||
"bind",
|
||||
defaultAddress,
|
||||
"Listening address (see https://pkg.go.dev/net?#Listen)",
|
||||
)
|
||||
addressTLS := flag.String(
|
||||
"tls-bind",
|
||||
"",
|
||||
"Listening address for TLS (see https://pkg.go.dev/net?#Listen)",
|
||||
)
|
||||
tlsCrtPath := flag.String("tls-crt", "", "When using TLS, path to certificate file")
|
||||
tlsKeyPath := flag.String("tls-key", "", "When using TLS, path to private key file")
|
||||
trustedHeader := flag.String("trusted-header", "", "Trusted request header for remote IP (e.g. X-Real-IP)")
|
||||
trustedHeader := flag.String(
|
||||
"trusted-header",
|
||||
"",
|
||||
"Trusted request header for remote IP (e.g. X-Real-IP)",
|
||||
)
|
||||
ver := flag.Bool("version", false, "Output version information and exit")
|
||||
|
||||
flag.Parse()
|
||||
|
@ -9,7 +9,18 @@ import (
|
||||
)
|
||||
|
||||
func TestIP4RootFromCli(t *testing.T) {
|
||||
uas := []string{"", "curl", "wget", "libwww-perl", "python", "ansible-httpget", "HTTPie", "WindowsPowerShell", "http_request", "Go-http-client"}
|
||||
uas := []string{
|
||||
"",
|
||||
"curl",
|
||||
"wget",
|
||||
"libwww-perl",
|
||||
"python",
|
||||
"ansible-httpget",
|
||||
"HTTPie",
|
||||
"WindowsPowerShell",
|
||||
"http_request",
|
||||
"Go-http-client",
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
req.Header.Set("X-Real-IP", testIP.ipv4)
|
||||
|
Loading…
Reference in New Issue
Block a user