aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-12 19:52:31 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-12 19:52:49 +0800
commit087551b68d8fd9fdf5f2dca27cbd1655194453e3 (patch)
tree48d93e5ae26416d9830fbd1943de8388b76610bc
parentrouter_http: Use http.Error instead of Fprintln to report errors (diff)
downloadforge-087551b68d8fd9fdf5f2dca27cbd1655194453e3.tar.gz
forge-087551b68d8fd9fdf5f2dca27cbd1655194453e3.tar.zst
forge-087551b68d8fd9fdf5f2dca27cbd1655194453e3.zip
*.go: Reformat
-rw-r--r--router_http.go1
-rw-r--r--ssh.go10
2 files changed, 5 insertions, 6 deletions
diff --git a/router_http.go b/router_http.go
index 29f558f..754cf10 100644
--- a/router_http.go
+++ b/router_http.go
@@ -117,4 +117,3 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
var err_bad_request = errors.New("Bad Request")
-
diff --git a/ssh.go b/ssh.go
index fb87a5e..26370c7 100644
--- a/ssh.go
+++ b/ssh.go
@@ -12,12 +12,12 @@ import (
)
func serve_ssh() error {
- hostKeyBytes, err := os.ReadFile(config.SSH.Key)
+ host_key_bytes, err := os.ReadFile(config.SSH.Key)
if err != nil {
return err
}
- hostKey, err := go_ssh.ParsePrivateKey(hostKeyBytes)
+ host_key, err := go_ssh.ParsePrivateKey(host_key_bytes)
if err != nil {
return err
}
@@ -60,8 +60,8 @@ func serve_ssh() error {
return
}
err = proc.Wait()
- if exitError, ok := err.(*exec.ExitError); ok {
- fmt.Fprintln(session.Stderr(), "Process exited with error", exitError.ExitCode())
+ if exit_error, ok := err.(*exec.ExitError); ok {
+ fmt.Fprintln(session.Stderr(), "Process exited with error", exit_error.ExitCode())
} else if err != nil {
fmt.Fprintln(session.Stderr(), "Error while waiting for process:", err)
}
@@ -70,7 +70,7 @@ func serve_ssh() error {
KeyboardInteractiveHandler: func(ctx glider_ssh.Context, challenge go_ssh.KeyboardInteractiveChallenge) bool { return true },
}
- server.AddHostKey(hostKey)
+ server.AddHostKey(host_key)
listener, err := net.Listen(config.SSH.Net, config.SSH.Addr)
if err != nil {