예제 #1
0
파일: auth.go 프로젝트: dream1986/ssh-chat
// newAuthKey returns string from an ssh.PublicKey used to index the key in our lookup.
func newAuthKey(key ssh.PublicKey) string {
	if key == nil {
		return ""
	}
	// FIXME: Is there a way to index pubkeys without marshal'ing them into strings?
	return sshd.Fingerprint(key)
}
예제 #2
0
func (i Identity) Whois() string {
	ip, _, _ := net.SplitHostPort(i.RemoteAddr().String())
	fingerprint := "(no public key)"
	if i.PublicKey() != nil {
		fingerprint = sshd.Fingerprint(i.PublicKey())
	}
	return fmt.Sprintf("name: %s"+message.Newline+
		" > ip: %s"+message.Newline+
		" > fingerprint: %s", i.Name(), ip, fingerprint)
}