MCPcopy Create free account
hub / github.com/appleboy/easyssh-proxy / getHostPublicKeyFile

Function getHostPublicKeyFile

easyssh_test.go:18–32  ·  view source on GitHub ↗
(keypath string)

Source from the content-addressed store, hash-verified

16)
17
18func getHostPublicKeyFile(keypath string) (ssh.PublicKey, error) {
19 var pubkey ssh.PublicKey
20 var err error
21 buf, err := os.ReadFile(keypath)
22 if err != nil {
23 return nil, err
24 }
25
26 pubkey, _, _, _, err = ssh.ParseAuthorizedKey(buf)
27 if err != nil {
28 return nil, err
29 }
30
31 return pubkey, nil
32}
33
34func TestGetKeyFile(t *testing.T) {
35 // missing file

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected