MCPcopy
hub / github.com/gliderlabs/ssh / HostKeyFile

Function HostKeyFile

options.go:27–43  ·  view source on GitHub ↗

HostKeyFile returns a functional option that adds HostSigners to the server from a PEM file at filepath.

(filepath string)

Source from the content-addressed store, hash-verified

25// HostKeyFile returns a functional option that adds HostSigners to the server
26// from a PEM file at filepath.
27func HostKeyFile(filepath string) Option {
28 return func(srv *Server) error {
29 pemBytes, err := os.ReadFile(filepath)
30 if err != nil {
31 return err
32 }
33
34 signer, err := gossh.ParsePrivateKey(pemBytes)
35 if err != nil {
36 return err
37 }
38
39 srv.AddHostKey(signer)
40
41 return nil
42 }
43}
44
45func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option {
46 return func(srv *Server) error {

Callers 1

ExampleHostKeyFileFunction · 0.92

Calls 1

AddHostKeyMethod · 0.80

Tested by 1

ExampleHostKeyFileFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…