From 3fa600b4d4c7488c9682fd4d9e085b99998e0f95 Mon Sep 17 00:00:00 2001 From: darkspir Date: Thu, 5 Dec 2024 13:53:34 +0100 Subject: [PATCH] Style correction of previous commits according to gofmt output --- cmd/rest-server/main.go | 17 ++++++++--------- handlers.go | 3 ++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/rest-server/main.go b/cmd/rest-server/main.go index bedd608..df927ed 100644 --- a/cmd/rest-server/main.go +++ b/cmd/rest-server/main.go @@ -2,12 +2,12 @@ package main import ( "context" + "crypto/tls" "errors" "fmt" "log" "net" "net/http" - "crypto/tls" "os" "os/signal" "path/filepath" @@ -46,8 +46,8 @@ func newRestServerApp() *restServerApp { Version: fmt.Sprintf("rest-server %s compiled with %v on %v/%v\n", version, runtime.Version(), runtime.GOOS, runtime.GOARCH), }, Server: restserver.Server{ - Path: filepath.Join(os.TempDir(), "restic"), - Listen: ":8000", + Path: filepath.Join(os.TempDir(), "restic"), + Listen: ":8000", TLSMinVer: "1.2", }, } @@ -63,7 +63,7 @@ func newRestServerApp() *restServerApp { flags.BoolVar(&rv.Server.TLS, "tls", rv.Server.TLS, "turn on TLS support") flags.StringVar(&rv.Server.TLSCert, "tls-cert", rv.Server.TLSCert, "TLS certificate path") flags.StringVar(&rv.Server.TLSKey, "tls-key", rv.Server.TLSKey, "TLS key path") - flags.StringVar(&rv.Server.TLSMinVer, "tls-min-ver", rv.Server.TLSMinVer, "TLS min version (default: 1.2)") + flags.StringVar(&rv.Server.TLSMinVer, "tls-min-ver", rv.Server.TLSMinVer, "TLS min version (default: 1.2)") flags.BoolVar(&rv.Server.NoAuth, "no-auth", rv.Server.NoAuth, "disable .htpasswd authentication") flags.StringVar(&rv.Server.HtpasswdPath, "htpasswd-file", rv.Server.HtpasswdPath, "location of .htpasswd file (default: \"/.htpasswd)\"") flags.BoolVar(&rv.Server.NoVerifyUpload, "no-verify-upload", rv.Server.NoVerifyUpload, @@ -166,9 +166,9 @@ func (app *restServerApp) runRoot(cmd *cobra.Command, args []string) error { app.listenerAddressMu.Unlock() tlscfg := &tls.Config{ - MinVersion: tls.VersionTLS12, - CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256}, - CipherSuites: []uint16{ + MinVersion: tls.VersionTLS12, + CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256}, + CipherSuites: []uint16{ tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, @@ -192,9 +192,8 @@ func (app *restServerApp) runRoot(cmd *cobra.Command, args []string) error { tlscfg.MinVersion = tls.VersionTLS12 } - srv := &http.Server{ - Handler: handler, + Handler: handler, TLSConfig: tlscfg, } diff --git a/handlers.go b/handlers.go index 7d78b61..ddd4e4f 100644 --- a/handlers.go +++ b/handlers.go @@ -159,7 +159,8 @@ func join(base string, names ...string) (string, error) { // splitURLPath splits the URL path into a folderPath of the subrepo, and // a remainder that can be passed to repo.Handler. // Example: /foo/bar/locks/0123... will be split into: -// ["foo", "bar"] and "/locks/0123..." +// +// ["foo", "bar"] and "/locks/0123..." func splitURLPath(urlPath string, maxDepth int) (folderPath []string, remainder string) { if !strings.HasPrefix(urlPath, "/") { // Really should start with "/"