Fix long lines (#2)

Using [golines](https://github.com/segmentio/golines):
`golines -w .`
This commit is contained in:
pando85 2021-11-18 19:26:53 +01:00 committed by GitHub
parent 126ae833b5
commit 1aa59f1b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 5 deletions

View File

@ -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...")

View File

@ -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()

View File

@ -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)