Documentation
¶
Index ¶
- func DisableLog()
- func FlushLog()
- func MessageCodeString(mc MessageCode) string
- func MessageCodeText(mc MessageCode) string
- func NewMessageInitialize(it *Message)
- func SetLogWriter(writer io.Writer) error
- func UseLogger(newLogger seelog.LoggerInterface)
- type Client
- type Cmd
- type CmdKind
- type Message
- type MessageCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MessageCodeString ¶
func MessageCodeString(mc MessageCode) string
func MessageCodeText ¶
func MessageCodeText(mc MessageCode) string
func NewMessageInitialize ¶
func NewMessageInitialize(it *Message)
func SetLogWriter ¶
SetLogWriter uses a specified io.Writer to output library log. Use this func if you are not using Seelog logging system in your app.
func UseLogger ¶
func UseLogger(newLogger seelog.LoggerInterface)
UseLogger uses a specified seelog.LoggerInterface to output library log. Use this func if you are using Seelog logging system in your app.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) SetSocketPath ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func (*Cmd) Encode ¶
-j eth0.33 239.255.11.101
+----+-----+---+-------------------------------+ | 40 | 'j' | 2 | "eth0.33\0239.255.11.101\0\0" | +----+-----+---+-------------------------------+ ^ ^ | | | | +-----cmd------+ sizeof(struct cmd) = 16 strlen(args) = 21 sizeof(3 NULL_CHARACTERS) = 3 2 => after each string arument 1 => at the end of arfs bye array length = 16 + 21 + 3 = 40 bytes strace: write(3, "(\0\0\0\0\0\0\0j\0\2\0\0\0\0\0eth0.33\000239.255.11.101\0\0", 40) = 40
func (*Cmd) StringBash ¶
type Message ¶
type Message struct {
Code MessageCode `json:"code,omitempty" yaml:"code"`
Text string `json:"text,omitempty" yaml:"text"`
}
func Errorf ¶
func Errorf(code MessageCode, params ...interface{}) *Message
func NewMessage ¶
func NewMessage() *Message
func (*Message) GetCode ¶
func (msg *Message) GetCode() MessageCode
func (*Message) Is ¶
func (msg *Message) Is(code MessageCode) bool
func (*Message) SetCode ¶
func (msg *Message) SetCode(v MessageCode) *Message
type MessageCode ¶
type MessageCode uint16
const ( MessageUnknown MessageCode = 0 Info MessageCode = 0x8000 Error MessageCode = 0x4000 )
const ( InfoOkJoin MessageCode = Info | iota InfoOkLeave )
const ( ErrorSocketConnect MessageCode = Error | iota ErrorSocketWrite ErrorSocketRead ErrorCmdEncode ErrorExec ErrorDropMembershipFailed99 ErrorFailedLeaveNotAMember )
func (MessageCode) String ¶
func (mc MessageCode) String() string
Click to show internal directories.
Click to hide internal directories.