Run formatter

This commit is contained in:
Elara 2024-08-04 16:35:24 -07:00
parent 4590fdadbe
commit fa60e18c22
4 changed files with 10 additions and 10 deletions

View File

@ -150,7 +150,7 @@ func Nomad(route config.Route) router.Handler {
return errors.New("task group not found") return errors.New("task group not found")
} }
var taskName = args[2] taskName := args[2]
if taskName == "" { if taskName == "" {
taskName = group.Tasks[0].Name taskName = group.Tasks[0].Name
} }
@ -189,7 +189,7 @@ func Nomad(route config.Route) router.Handler {
} }
} }
var taskName = args[3] taskName := args[3]
if taskName == "" { if taskName == "" {
taskName = group.Tasks[0].Name taskName = group.Tasks[0].Name
} }

View File

@ -47,7 +47,7 @@ type proxySettings struct {
UserMap *cty.Value `cty:"userMap"` UserMap *cty.Value `cty:"userMap"`
} }
// Proxy is the proxy backend. It returns a handler that establishes a proxy // Proxy is the proxy backend. It returns a handler that establishes a proxy
// session to a remote server based on the provided configuration. // session to a remote server based on the provided configuration.
func Proxy(route config.Route) router.Handler { func Proxy(route config.Route) router.Handler {
return func(sess ssh.Session, arg string) error { return func(sess ssh.Session, arg string) error {
@ -70,7 +70,7 @@ func Proxy(route config.Route) router.Handler {
if opts.User == nil { if opts.User == nil {
userMap := ctyObjToStringMap(opts.UserMap) userMap := ctyObjToStringMap(opts.UserMap)
user, _ := sshctx.GetUser(sess.Context()) user, _ := sshctx.GetUser(sess.Context())
if muser, ok := userMap[user.Name]; ok { if muser, ok := userMap[user.Name]; ok {
opts.User = &muser opts.User = &muser
} else { } else {
@ -100,19 +100,19 @@ func Proxy(route config.Route) router.Handler {
if err != nil { if err != nil {
return err return err
} }
knownHostHandler, err := goph.DefaultKnownHosts() knownHostHandler, err := goph.DefaultKnownHosts()
if err != nil { if err != nil {
return err return err
} }
c.Config.Callback = func(host string, remote net.Addr, key gossh.PublicKey) error { c.Config.Callback = func(host string, remote net.Addr, key gossh.PublicKey) error {
println("hi") println("hi")
err = goph.AddKnownHost(host, remote, key, "") err = goph.AddKnownHost(host, remote, key, "")
if err != nil { if err != nil {
return err return err
} }
return knownHostHandler(host, remote, key) return knownHostHandler(host, remote, key)
} }
baseCmd := sess.Command() baseCmd := sess.Command()
@ -187,7 +187,7 @@ func sshHandleResize(resizeCh <-chan ssh.Window, cmd *goph.Cmd) {
// readPassword reads a password from the SSH session, sending an asterisk // readPassword reads a password from the SSH session, sending an asterisk
// for each character typed. // for each character typed.
// //
// It handles interrupts (Ctrl+C), EOF (Ctrl+D), and backspace. // It handles interrupts (Ctrl+C), EOF (Ctrl+D), and backspace.
// It returns what it read once it receives a carriage return or a newline. // It returns what it read once it receives a carriage return or a newline.
func readPassword(sess ssh.Session) (string, error) { func readPassword(sess ssh.Session) (string, error) {

View File

@ -95,7 +95,7 @@ func Serial(route config.Route) router.Handler {
file, baudRate, config = filepath.Join(*opts.Directory, args[0]), args[1], args[2] file, baudRate, config = filepath.Join(*opts.Directory, args[0]), args[1], args[2]
} }
} }
if !route.Permissions.IsAllowed(user, filepath.Base(file)) { if !route.Permissions.IsAllowed(user, filepath.Base(file)) {
return router.ErrUnauthorized return router.ErrUnauthorized
} }

View File

@ -29,7 +29,7 @@ import (
type PermissionsMap map[string]map[string][]string type PermissionsMap map[string]map[string][]string
// IsAllowed checks if the user has permissions for all the specified items. // IsAllowed checks if the user has permissions for all the specified items.
// //
// The default policy is deny, and denials take priority, so if one item // The default policy is deny, and denials take priority, so if one item
// in items is set to deny, IsAllowed will always return false, even if // in items is set to deny, IsAllowed will always return false, even if
// other items are explicitly allowed. // other items are explicitly allowed.