Documentation ¶
Index ¶
- Constants
- Variables
- func JSON(r io.Reader, data interface{}) (io.Reader, error)
- type Batch
- type BinaryHistory
- func (g *BinaryHistory) Add(d Msg)
- func (g *BinaryHistory) DecodeAppendFile(r io.Reader, cb func(Msg)) error
- func (g *BinaryHistory) Each(cb func(Msg) bool)
- func (g *BinaryHistory) Last(n int, cb func(Msg) bool)
- func (g *BinaryHistory) Load(file string) error
- func (g *BinaryHistory) NeedsSave() bool
- func (g *BinaryHistory) Save(file string) error
- func (g *BinaryHistory) StartAppend() error
- func (g *BinaryHistory) StopAppend()
- type BinaryReader
- type BinaryWriter
- type BufferedWriteFlusher
- type Channel
- type ChannelMsg
- type Client
- type ClientFilter
- type ConnectionReason
- type CryptoLabel
- type Decoder
- type DecoderVersion
- type DeriveSecret
- type DeriveSecret32
- type EOF
- type FlushFlusher
- type Flusher
- type Hex
- type IdentifyMsg
- type Limit
- type Msg
- type NameOnlyClient
- type NeverEqual
- type NilMsg
- type NoClose
- type NoRun
- type NoRunClose
- type NoSave
- type PassthroughWriteFlusher
- type Proto
- type PubKeyMessage
- type PubKeyServerMessage
- func (m PubKeyServerMessage) Binary(w BinaryWriter) error
- func (m PubKeyServerMessage) Fingerprint() string
- func (m PubKeyServerMessage) FromBinary(r BinaryReader) (Msg, error)
- func (m PubKeyServerMessage) FromJSON(r io.Reader) (Msg, io.Reader, error)
- func (m PubKeyServerMessage) JSON(w io.Writer) error
- func (m PubKeyServerMessage) PubKey() *crypto.PubKey
- type RWFactory
- type Saver
- type SendOnly
- type Sender
- type StatusCode
- type StatusMsg
- type StringDecoder
- type StringEncoder
- type SymmetricTestMessage
- func (s SymmetricTestMessage) Binary(w BinaryWriter) error
- func (s SymmetricTestMessage) Equal(m Msg) bool
- func (s SymmetricTestMessage) FromBinary(r BinaryReader) (Msg, error)
- func (s SymmetricTestMessage) FromJSON(r io.Reader) (Msg, io.Reader, error)
- func (s SymmetricTestMessage) JSON(w io.Writer) error
- type Uploader
- type User
- type UserCollection
- type UserUpdateHandler
- type WriteFlusher
- type WriterFlusher
Constants ¶
View Source
const ( ServerMinKeySize = 512 ServerKeySize = 512 ClientMinKeySize = 128 ClientKeySize = 256 )
Variables ¶
View Source
var ErrKeyExchange = errors.New("invalid key exchange")
Functions ¶
Types ¶
type Batch ¶
type Batch struct { Filter ClientFilter Msg Msg }
type BinaryHistory ¶
type BinaryHistory struct {
// contains filtered or unexported fields
}
func NewBinaryHistory ¶
func NewBinaryHistory( max int, appendOnlyFile string, current DecoderVersion, dec map[DecoderVersion]Decoder, ) (*BinaryHistory, error)
func (*BinaryHistory) Add ¶
func (g *BinaryHistory) Add(d Msg)
func (*BinaryHistory) DecodeAppendFile ¶
func (g *BinaryHistory) DecodeAppendFile(r io.Reader, cb func(Msg)) error
func (*BinaryHistory) Each ¶
func (g *BinaryHistory) Each(cb func(Msg) bool)
func (*BinaryHistory) Load ¶
func (g *BinaryHistory) Load(file string) error
func (*BinaryHistory) NeedsSave ¶
func (g *BinaryHistory) NeedsSave() bool
func (*BinaryHistory) Save ¶
func (g *BinaryHistory) Save(file string) error
func (*BinaryHistory) StartAppend ¶
func (g *BinaryHistory) StartAppend() error
func (*BinaryHistory) StopAppend ¶
func (g *BinaryHistory) StopAppend()
type BinaryReader ¶
type BinaryWriter ¶
type BufferedWriteFlusher ¶
type BufferedWriteFlusher struct {
// contains filtered or unexported fields
}
func (*BufferedWriteFlusher) Flush ¶
func (w *BufferedWriteFlusher) Flush() error
type ChannelMsg ¶
func BinaryChannelMsg ¶
func BinaryChannelMsg(r BinaryReader) (ChannelMsg, error)
func JSONChannelMsg ¶
func (ChannelMsg) Binary ¶
func (h ChannelMsg) Binary(w BinaryWriter) error
func (ChannelMsg) Equal ¶
func (m ChannelMsg) Equal(Msg) bool
func (ChannelMsg) FromBinary ¶
func (m ChannelMsg) FromBinary(r BinaryReader) (Msg, error)
type ClientFilter ¶
type ClientFilter struct { Client Client Channel string HasChannel []string To []string NotTo []string }
func (ClientFilter) CheckChannels ¶
func (f ClientFilter) CheckChannels(n []string) bool
func (ClientFilter) CheckIdentity ¶
func (f ClientFilter) CheckIdentity(c Client) bool
func (ClientFilter) CheckIdentityAndName ¶
func (f ClientFilter) CheckIdentityAndName(c Client) bool
func (ClientFilter) CheckName ¶
func (f ClientFilter) CheckName(n string) bool
type ConnectionReason ¶
type ConnectionReason byte
const ( Connect ConnectionReason = iota Disconnect )
type CryptoLabel ¶
type CryptoLabel string
const ( CryptoClientWrite CryptoLabel = "write" CryptoClientRead CryptoLabel = "read" CryptoClientMacWrite CryptoLabel = "mac-write" CryptoClientMacRead CryptoLabel = "mac-read" CryptoServerWrite CryptoLabel = CryptoClientRead CryptoServerRead CryptoLabel = CryptoClientWrite CryptoServerMacWrite CryptoLabel = CryptoClientMacRead CryptoServerMacRead CryptoLabel = CryptoClientMacWrite )
type Decoder ¶
type Decoder = func(r BinaryReader) (Msg, error)
type DecoderVersion ¶
type DecoderVersion string
type DeriveSecret ¶
type DeriveSecret func(label CryptoLabel) []byte
func CommonSecret ¶
func CommonSecret(c PubKeyMessage, s PubKeyServerMessage, serverPrivate *crypto.Key, size int) (DeriveSecret, error)
type DeriveSecret32 ¶
type DeriveSecret32 func(label CryptoLabel) [32]byte
func CommonSecret32 ¶
func CommonSecret32(c PubKeyMessage, s PubKeyServerMessage, serverPrivate *crypto.Key) (DeriveSecret32, error)
type EOF ¶
type EOF struct {
NilMsg
}
func BinaryMessage ¶
func BinaryMessage(r BinaryReader) (EOF, error)
func (EOF) FromBinary ¶
func (m EOF) FromBinary(r BinaryReader) (Msg, error)
type FlushFlusher ¶
type FlushFlusher struct {
// contains filtered or unexported fields
}
func (*FlushFlusher) Flush ¶
func (w *FlushFlusher) Flush() error
type IdentifyMsg ¶
type IdentifyMsg struct { Data string `json:"d"` Channels []string `json:"c"` Version string `json:"v"` NeverEqual NoClose }
func BinaryIdentifyMsg ¶
func BinaryIdentifyMsg(r BinaryReader) (IdentifyMsg, error)
func JSONIdentifyMsg ¶
func (IdentifyMsg) Binary ¶
func (h IdentifyMsg) Binary(w BinaryWriter) error
func (IdentifyMsg) FromBinary ¶
func (m IdentifyMsg) FromBinary(r BinaryReader) (Msg, error)
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
func (Limit) LimitReader ¶
type NameOnlyClient ¶
type NameOnlyClient struct {
// contains filtered or unexported fields
}
func NewBot ¶
func NewBot(name string) *NameOnlyClient
func NewClient ¶
func NewClient(name string, bot bool) *NameOnlyClient
func NewUser ¶
func NewUser(name string) *NameOnlyClient
func (*NameOnlyClient) Bot ¶
func (n *NameOnlyClient) Bot() bool
func (*NameOnlyClient) Name ¶
func (n *NameOnlyClient) Name() string
type NeverEqual ¶
type NeverEqual struct{}
func (NeverEqual) Equal ¶
func (n NeverEqual) Equal(Msg) bool
type NilMsg ¶
type NilMsg struct { NeverEqual NoClose }
func BinaryNilMessage ¶
func BinaryNilMessage(r BinaryReader) (m NilMsg, err error)
func (NilMsg) Binary ¶
func (m NilMsg) Binary(w BinaryWriter) error
func (NilMsg) FromBinary ¶
func (m NilMsg) FromBinary(r BinaryReader) (Msg, error)
type NoRunClose ¶
type PassthroughWriteFlusher ¶
func (*PassthroughWriteFlusher) Flush ¶
func (w *PassthroughWriteFlusher) Flush() error
type PubKeyMessage ¶
type PubKeyMessage struct { NeverEqual NoClose // contains filtered or unexported fields }
func BinaryPubKeyMessage ¶
func BinaryPubKeyMessage(r BinaryReader) (p PubKeyMessage, err error)
func JSONPubKeyMessage ¶
func NewPubKeyMessage ¶
func NewPubKeyMessage(key *crypto.Key, m PubKeyServerMessage) (PubKeyMessage, error)
func (PubKeyMessage) Binary ¶
func (m PubKeyMessage) Binary(w BinaryWriter) error
func (PubKeyMessage) Fingerprint ¶
func (m PubKeyMessage) Fingerprint() string
func (PubKeyMessage) FromBinary ¶
func (m PubKeyMessage) FromBinary(r BinaryReader) (Msg, error)
type PubKeyServerMessage ¶
type PubKeyServerMessage struct { NeverEqual NoClose // contains filtered or unexported fields }
func BinaryPubKeyServerMessage ¶
func BinaryPubKeyServerMessage(r BinaryReader) (p PubKeyServerMessage, err error)
func JSONPubKeyServerMessage ¶
func NewPubKeyServerMessage ¶
func NewPubKeyServerMessage(key *crypto.Key) (PubKeyServerMessage, error)
func (PubKeyServerMessage) Binary ¶
func (m PubKeyServerMessage) Binary(w BinaryWriter) error
func (PubKeyServerMessage) Fingerprint ¶
func (m PubKeyServerMessage) Fingerprint() string
func (PubKeyServerMessage) FromBinary ¶
func (m PubKeyServerMessage) FromBinary(r BinaryReader) (Msg, error)
func (PubKeyServerMessage) PubKey ¶ added in v0.3.11
func (m PubKeyServerMessage) PubKey() *crypto.PubKey
type RWFactory ¶
type RWFactory interface { Reader(io.Reader) io.Reader Writer(io.Writer) io.Writer BinaryReader(io.Reader) BinaryReader BinaryWriter(io.Writer) BinaryWriter }
func NewRWFactory ¶
type Sender ¶
type Sender interface { Broadcast(ClientFilter, Msg) error // BroadcastError(ClientFilter, error) error BroadcastBatch([]Batch) error }
type StatusCode ¶
type StatusCode byte
const ( StatusOK StatusCode = iota StatusNOK StatusUpdateClient StatusNotAllowed )
type StatusMsg ¶
type StatusMsg struct { Code StatusCode `json:"code"` Err string `json:"err"` NeverEqual NoClose }
func BinaryStatusMsg ¶
func BinaryStatusMsg(r BinaryReader) (StatusMsg, error)
func (StatusMsg) Binary ¶
func (m StatusMsg) Binary(w BinaryWriter) error
func (StatusMsg) FromBinary ¶
func (m StatusMsg) FromBinary(r BinaryReader) (Msg, error)
func (StatusMsg) Is ¶
func (m StatusMsg) Is(s StatusCode) bool
type StringDecoder ¶
type StringEncoder ¶
type SymmetricTestMessage ¶
type SymmetricTestMessage struct { NoClose // contains filtered or unexported fields }
func BinarySymmetricTestMessage ¶
func BinarySymmetricTestMessage(r BinaryReader) (p SymmetricTestMessage, err error)
func NewSymmetricTestMessage ¶
func NewSymmetricTestMessage() (SymmetricTestMessage, error)
func (SymmetricTestMessage) Binary ¶
func (s SymmetricTestMessage) Binary(w BinaryWriter) error
func (SymmetricTestMessage) Equal ¶
func (s SymmetricTestMessage) Equal(m Msg) bool
func (SymmetricTestMessage) FromBinary ¶
func (s SymmetricTestMessage) FromBinary(r BinaryReader) (Msg, error)
type UserCollection ¶
type UserUpdateHandler ¶
type UserUpdateHandler interface {
UserUpdate(Client, ConnectionReason) error
}
func MultiUserUpdateHandler ¶
func MultiUserUpdateHandler(handlers ...UserUpdateHandler) UserUpdateHandler
type WriteFlusher ¶
func NewBuffered ¶
func NewBuffered(w io.Writer) WriteFlusher
func NewPassthrough ¶
func NewPassthrough(w io.Writer) WriteFlusher
type WriterFlusher ¶
Click to show internal directories.
Click to hide internal directories.