func NewSession(gateway *Gateway, connection *ssh.ServerConn) (*Session, error) { glog.V(1).Infof("new session: user = %s, remote = %v", connection.User(), connection.RemoteAddr()) return &Session{ gateway: gateway, connection: connection, user: connection.User(), remoteAddr: connection.RemoteAddr(), localAddr: connection.LocalAddr(), services: make(map[string]map[uint16]bool), lock: &sync.Mutex{}, active: true, created: time.Now(), used: time.Now(), channelsClosed: 0, bytesRead: 0, bytesWritten: 0, }, nil }