Documentation ¶
Index ¶
- Constants
- Variables
- func ClearLocalCache()
- func GetGroupKey(name string) string
- func GetKey(name string) string
- func Join(root string, files ...string) string
- func L(tmp string, args ...interface{})
- func LocalGroupKeys() (kmac []string)
- func LocalKeys() (kmac []string)
- func NewKey() string
- func Ok(tmp string, args ...interface{})
- func SecurityCheckName(name string)
- func SetGroupKey(name, key string)
- func SetHome(h string)
- func SetKey(name, key string)
- func ToMd5(key string) string
- func VerifyKey(name, mac string) (exists, group bool)
- type ChatRoom
- func (chat *ChatRoom) ClearLocalCache()
- func (chat *ChatRoom) CloseWithClear(t int)
- func (chat *ChatRoom) CloudFiles(groupName ...string) (fs []string)
- func (chat *ChatRoom) Contact() (users []*User)
- func (chat *ChatRoom) CreateGroup(name string)
- func (chat *ChatRoom) ExistsUser(name string) bool
- func (chat *ChatRoom) GetFile(name string, groupName ...string) (err error)
- func (chat *ChatRoom) GetMyIcon() (buf []byte, err error)
- func (chat *ChatRoom) GetMyIconWithPath() string
- func (chat *ChatRoom) GetMyLocalHome() string
- func (chat *ChatRoom) GetTalker() string
- func (chat *ChatRoom) GetTalkerSIcon(name ...string) (buf []byte, err error)
- func (chat *ChatRoom) GetTalkerSIconPath(name ...string) (string, error)
- func (chat *ChatRoom) GroupVerify(name string) bool
- func (chat *ChatRoom) History()
- func (chat *ChatRoom) Init(sshstr string) (err error)
- func (chat *ChatRoom) IsGroupName(name string) (string, bool)
- func (chat *ChatRoom) JoinGroup(name string)
- func (chat *ChatRoom) Login(restoresKey ...string) (logined bool)
- func (chat *ChatRoom) Permitt(gname, uname string)
- func (chat *ChatRoom) Read() *Message
- func (chat *ChatRoom) ReadEncryptedMessage(msg, from, to, group string, date time.Time, tp int, crypted bool) (m *Message, err error)
- func (chat *ChatRoom) RemoveGroup(name string)
- func (chat *ChatRoom) RestoreKeyFromServer(key string) bool
- func (chat *ChatRoom) SaveKeyToServer(key string) bool
- func (chat *ChatRoom) SendFile(path string, groupName ...string) (err error)
- func (chat *ChatRoom) SetMyIcon(path string) (err error)
- func (chat *ChatRoom) SetWacher(call func(msg *Message))
- func (chat *ChatRoom) TalkTo(name string) (icon string)
- func (chat *ChatRoom) UpdateMyIconWithPath() string
- func (chat *ChatRoom) UpdateTalkerIconWithPath(name ...string) string
- func (chat *ChatRoom) Write(msg string)
- func (chat *ChatRoom) WriteGroup(gname, msg string)
- type CipherFileHeader
- type EnHeader
- type Group
- type Message
- type Stream
- func NewStreamWithAuthor(author string, loadGroupKey bool) (stream *Stream, err error)
- func NewStreamWithAuthorNoSave(author string, loadGroupKey bool) (stream *Stream, err error)
- func NewStreamWithBase64Key(keyb64 string) (stream *Stream, err error)
- func NewStreamWithRandomeKey() (stream *Stream, err error)
- func (stream *Stream) De(cipher []byte) (plain []byte)
- func (stream *Stream) DecryptFile(cipherFile, plainFile string, bar ...func(int64)) (err error)
- func (stream *Stream) En(plain []byte) (cipher []byte)
- func (stream *Stream) EncryptFile(plainFile, cipherFile string, bar ...func(int64)) (err error)
- func (steam *Stream) Flow(raw []byte) (out []byte)
- func (stream *Stream) FlowDe(raw64 string) (out string)
- func (stream *Stream) FlowEn(raw string) (out string)
- func (stream *Stream) LoadCipherByAuthor(author string) (err error)
- func (stream *Stream) ReBildCipherByKey(keyb64 string)
- func (stream *Stream) SaveKey(author string, grouped bool)
- func (stream *Stream) StreamDecrypt(dst io.Writer, src io.Reader, bar ...func(uploaded int64)) (copied int64, err error)
- func (stream *Stream) StreamEncrypt(dst io.Writer, src io.Reader, bar ...func(updated int64)) (copied int64, err error)
- type User
- type Vps
- func (vps *Vps) AllowJoinGroup(gname, uname string)
- func (vps *Vps) CacheMsg(msg *Message) (err error)
- func (vps *Vps) Close()
- func (vps *Vps) CloseWithClear(t int)
- func (vps *Vps) CloudFiles(groupName ...string) (files []string)
- func (vps *Vps) Connect() (client *ssh.Client, sess *ssh.Session, err error)
- func (vps *Vps) Contact() (users []*User, err error)
- func (vps *Vps) ContactTo(name string) (ip string, err error)
- func (vps *Vps) CreateGroup(name string)
- func (vps *Vps) CreateMe() (canlogin bool)
- func (vps *Vps) D(en string) string
- func (vps *Vps) DownloadCloud(name string, dealStream func(reader io.Reader) error, groupName ...string) (err error)
- func (vps *Vps) E(raw string) string
- func (vps *Vps) ExchangeKeyCheck() (my, you bool)
- func (vps *Vps) Exists(name string) (exists bool, dir bool)
- func (vps *Vps) GenerateIcon() (buf []byte, err error)
- func (vps *Vps) GetGroupName(name string) string
- func (vps *Vps) GetGroupVpsName(name string) string
- func (vps *Vps) GetRawMsgTo() string
- func (vps *Vps) GetRemoteKeyPath(key string) string
- func (vps *Vps) GetVpsName() string
- func (vps *Vps) GroupCheck(name string) (exists, verified bool)
- func (vps *Vps) GroupList() (groups []string)
- func (vps *Vps) HeartBeat()
- func (vps *Vps) History() (msgs []*Message, err error)
- func (vps *Vps) IfAlive() (out bool)
- func (vps *Vps) IfLogined() (logined bool)
- func (vps *Vps) Init() (err error)
- func (vps *Vps) JoinGroup(name string)
- func (vps *Vps) KickOld()
- func (vps *Vps) OnMessage(call func(group, from, to, msg string, crypted bool, tp int, date time.Time))
- func (vps *Vps) RecvGroupMsg() (msgs []*Message)
- func (vps *Vps) RecvMsg() (msgs []*Message, err error)
- func (vps *Vps) RemoveGroup(name string)
- func (vps Vps) Rm(file string) bool
- func (vps *Vps) SaveKeyToServer(key string) (ok bool)
- func (vps *Vps) Security()
- func (vps *Vps) SendGroupMsg(groupName string, msg string, encrypted ...bool) (err error)
- func (vps *Vps) SendKeyReq() (err error)
- func (vps *Vps) SendKeyTo(target, key string, grouped ...string) (err error)
- func (vps *Vps) SendMsg(msg string, encrypted ...bool) (err error)
- func (vps *Vps) SetMsgTo(name string)
- func (vps *Vps) SetProxy(url string)
- func (vps Vps) String() string
- func (vps *Vps) TimerClear(delay int, groupname ...string) (err error)
- func (vps *Vps) TryRestoreKey(key string) bool
- func (vps *Vps) WithSendFile(path string, ...) (err error)
- func (vps *Vps) WithSendFileToOwn(path string, ...) (err error)
- func (vps *Vps) WithSftp(done func(client *sftp.Client) error) (err error)
- func (vps *Vps) WithSftpDir(path string, done func(fs os.FileInfo) error) (err error)
- func (vps *Vps) WithSftpRead(path string, flags int, done func(fp io.ReadCloser) error) (err error)
- func (vps *Vps) WithSftpReadAsLines(path string, flags ...int) (lines []string, err error)
- func (vps *Vps) WithSftpWrite(path string, flags int, done func(fp io.WriteCloser) error) (err error)
Constants ¶
View Source
const ( NO_TALKER = 0x000 TALKER_REQ = 0x001 TALKER_I_HAVE = 0x010 TALKER_YOU_HAVE = 0x100 TALKER_CONNECTED = 0x111 TALKER_ERR = -1 )
View Source
const ( MSG_TP_NORMAL = iota MSG_TP_GROUP )
View Source
const FILE_CIPHER_HEADER_LEN = 188
View Source
const TIME_TMP = "2006-1-2 15:04:05 -0700 MST"
Variables ¶
View Source
var ( // HOME, _ = os.UserHomeDir() KeysHome = filepath.Join(HOME, ".sshchat", "keys") GroupKeysHome = filepath.Join(HOME, ".sshchat", "gkeys") )
View Source
var ( MSG_HISTORY = "message.history.txt" MSG_FILE = "message.txt" MSG_HEART = "heart" MSG_PRIVATE_KEY = "keys" MSG_FILE_ROOT = "files" MSG_HELLO = "info" MSG_ICON = "icon.png" MSG_TMP_FILE = "tmp_file" ROOT = "/tmp/SecureRoom" GROUP_TAIL = "_GroUP" TMP = "/tmp" MSG_KICK = "kick" MSG_CLIP_PREFIX = "[clipbroad]:" MsgIsNULL = fmt.Errorf("msg is null!!") )
View Source
var (
HOME, _ = os.UserHomeDir()
)
Functions ¶
func ClearLocalCache ¶ added in v1.1.0
func ClearLocalCache()
func GetGroupKey ¶
func LocalGroupKeys ¶
func LocalGroupKeys() (kmac []string)
func SecurityCheckName ¶
func SecurityCheckName(name string)
func SetGroupKey ¶
func SetGroupKey(name, key string)
Types ¶
type ChatRoom ¶
func NewChatRoom ¶
NewChatRoom HOME default is '~'
func (*ChatRoom) ClearLocalCache ¶ added in v1.1.0
func (chat *ChatRoom) ClearLocalCache()
func (*ChatRoom) CloseWithClear ¶
func (*ChatRoom) CloudFiles ¶
func (*ChatRoom) CreateGroup ¶
func (*ChatRoom) ExistsUser ¶ added in v1.1.1
func (*ChatRoom) GetMyIconWithPath ¶ added in v1.1.0
func (*ChatRoom) GetMyLocalHome ¶ added in v1.1.0
func (*ChatRoom) GetTalkerSIcon ¶ added in v1.1.0
func (*ChatRoom) GetTalkerSIconPath ¶ added in v1.1.0
func (*ChatRoom) GroupVerify ¶
func (*ChatRoom) ReadEncryptedMessage ¶
func (*ChatRoom) RemoveGroup ¶
func (*ChatRoom) RestoreKeyFromServer ¶
func (*ChatRoom) SaveKeyToServer ¶
func (*ChatRoom) UpdateMyIconWithPath ¶ added in v1.1.0
func (*ChatRoom) UpdateTalkerIconWithPath ¶ added in v1.1.0
func (*ChatRoom) WriteGroup ¶
type CipherFileHeader ¶
type Stream ¶
type Stream struct { Key string `json:"key"` Author string `json:"author"` // contains filtered or unexported fields }
func NewStreamWithAuthor ¶
func NewStreamWithAuthorNoSave ¶ added in v1.1.4
func NewStreamWithBase64Key ¶
func NewStreamWithRandomeKey ¶
func (*Stream) DecryptFile ¶
func (*Stream) EncryptFile ¶
func (*Stream) LoadCipherByAuthor ¶
func (*Stream) ReBildCipherByKey ¶
func (*Stream) StreamDecrypt ¶
type User ¶
type Vps ¶
type Vps struct { IP string USER string PWD string TAG string Region string Proxy string // contains filtered or unexported fields }
func (*Vps) AllowJoinGroup ¶
func (*Vps) CloseWithClear ¶
func (*Vps) CloudFiles ¶
func (*Vps) CreateGroup ¶
func (*Vps) DownloadCloud ¶
func (*Vps) ExchangeKeyCheck ¶
func (*Vps) GenerateIcon ¶ added in v1.1.0
func (*Vps) GetGroupName ¶
func (*Vps) GetGroupVpsName ¶
func (*Vps) GetRawMsgTo ¶
func (*Vps) GetRemoteKeyPath ¶ added in v1.1.0
func (*Vps) GetVpsName ¶
func (*Vps) GroupCheck ¶
func (*Vps) RecvGroupMsg ¶
func (*Vps) RemoveGroup ¶
func (*Vps) SaveKeyToServer ¶
func (*Vps) SendGroupMsg ¶
func (*Vps) SendKeyReq ¶
func (*Vps) TryRestoreKey ¶
func (*Vps) WithSendFile ¶
func (*Vps) WithSendFileToOwn ¶ added in v1.1.0
func (*Vps) WithSftpDir ¶
func (*Vps) WithSftpRead ¶
func (*Vps) WithSftpReadAsLines ¶
func (*Vps) WithSftpWrite ¶
Click to show internal directories.
Click to hide internal directories.