model

package
v0.0.0-...-ea3c427 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatAgent = "agent"
)
View Source
const (
	StatSession = "session"
)
View Source
const (
	TableUser = "user"
)

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password []byte) (hash []byte)

func PutUser

func PutUser(session *mgo.Session, db string, user *User) error

Types

type Agent

type Agent struct {
	ETime      time.Time
	Id         bson.ObjectId
	LocalAddr  string
	RemoteAddr string
	SessionId  bson.ObjectId
	User       string
}

type AgentIfaces

type AgentIfaces struct {
	sync.RWMutex
	M map[bson.ObjectId]iface.Agent
}

func NewAgentIfaces

func NewAgentIfaces() *AgentIfaces

func (*AgentIfaces) Add

func (m *AgentIfaces) Add(a iface.Agent)

func (*AgentIfaces) Remove

func (m *AgentIfaces) Remove(a iface.Agent)

type Agents

type Agents struct {
	M map[bson.ObjectId]*Agent
}

type Auth

type Auth struct {
	Addr, User    string
	Password, Key []byte
}

type Session

type Session struct {
	Agents        map[bson.ObjectId]*Agent
	ETime         time.Time
	ClientVersion []byte
	Id            bson.ObjectId
	LocalAddr     string
	RemoteAddr    string
	ServerVersion []byte
	User          string
}

type SessionIfaces

type SessionIfaces struct {
	sync.RWMutex
	M map[bson.ObjectId]iface.Session
}

func NewSessionIfaces

func NewSessionIfaces() *SessionIfaces

func (*SessionIfaces) Add

func (m *SessionIfaces) Add(s iface.Session)

func (*SessionIfaces) Remove

func (m *SessionIfaces) Remove(s iface.Session)

type Sessions

type Sessions struct {
	M map[bson.ObjectId]*Session
}

type Stat

type Stat struct {
	ETime    time.Time
	Sessions int
	Agents   int
}

type User

type User struct {
	CreateAt time.Time `bson:"create_at"`

	Name string `bson:"name"`

	Keys     map[string][]byte `bson:"keys"`
	Password []byte            `bson:"password"`

	Permissions ssh.Permissions
}

func GetUser

func GetUser(session *mgo.Session, db, name string) (*User, error)

func (*User) CheckPassword

func (user *User) CheckPassword(password []byte) bool

func (*User) CheckPublicKey

func (user *User) CheckPublicKey(key []byte) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL