(s ssh.Session)
| 21 | } |
| 22 | |
| 23 | func NewSession(s ssh.Session) *Session { |
| 24 | user := s.User() |
| 25 | host, port, _ := net.SplitHostPort(s.RemoteAddr().String()) |
| 26 | var publicKey string |
| 27 | if pk := s.PublicKey(); pk != nil { |
| 28 | publicKey = utils.StringifyPublicKey(pk) |
| 29 | } |
| 30 | return &Session{ |
| 31 | User: user, |
| 32 | Host: host, |
| 33 | Port: port, |
| 34 | Command: s.RawCommand(), |
| 35 | Subsystem: s.Subsystem(), |
| 36 | PublicKey: publicKey, |
| 37 | RemoteAddr: s.RemoteAddr().String(), |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func (s *Session) FormatArg(arg string) string { |
| 42 | return formatTemplate(arg, s) |
no test coverage detected