Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizedKeys ¶
type AuthorizedKeys struct{}
AuthorizedKeys is a struct that formats ssh keys as an authorized_keys file. It implements Formatter.
func (AuthorizedKeys) WriteTo ¶
func (AuthorizedKeys) WriteTo(username, source string, keys []ssh.PublicKey, r *http.Request, w http.ResponseWriter) (int, error)
WriteTo writes the ssh keys, which are associated with the given user, into w. They will be formatted in authorized_keys format and include an appropriate Content-Disposition header. Returns the number of bytes written in the body of w and an error.
type Formatter ¶
type Formatter interface { // WriteTo writes the ssh keys, which are associated with the given user, into w. // Returns the number of bytes written and an error. WriteTo(username, source string, keys []ssh.PublicKey, r *http.Request, w http.ResponseWriter) (int, error) }
Formatter is an object that can write ssh keys to an http.ResponseWriter.
type HTML ¶
type HTML struct { // Suffix is called to write a suffix to the html response Suffix func(w io.Writer) error }
FormatterShellScript is a zero-size struct that formats ssh keys as a user-facing html page. It implements Formatter.
func (HTML) WriteTo ¶
func (h HTML) WriteTo(username, source string, keys []ssh.PublicKey, r *http.Request, w http.ResponseWriter) (int, error)
WriteTo writes the ssh keys, which are associated with the given user, into w. They will be formatted as a shell script that updates or creates the file '.ssh/authorized_keys' and include an appropriate Content-Disposition header. Returns the number of bytes written in the body of w and an error.
type Magic ¶
type Magic struct { HTML HTML AuthorizedKeys AuthorizedKeys }
Magic calls either FormatterAuthorizedKeys or FormatterHTML
type ShellScript ¶
type ShellScript struct{}
ShellScript is a zero-size struct that formats ssh keys as a shell script updating an authorized_keys file. It implements Formatter.
func (ShellScript) WriteTo ¶
func (ShellScript) WriteTo(username, source string, keys []ssh.PublicKey, r *http.Request, w http.ResponseWriter) (int, error)
WriteTo writes the ssh keys, which are associated with the given user, into w. They will be formatted as a shell script that updates or creates the file '.ssh/authorized_keys' and include an appropriate Content-Disposition header. Returns the number of bytes written in the body of w and an error.