Documentation ¶
Index ¶
- Constants
- type ClientData
- type Command
- type EvFunc
- type EventHandler
- type IPMSG
- func (ipmsg *IPMSG) AddEventHandler(ev *EventHandler)
- func (ipmsg *IPMSG) BuildData(addr *net.UDPAddr, msg string, cmd Command) *ClientData
- func (ipmsg *IPMSG) Close() error
- func (ipmsg *IPMSG) GetNewPacketNum() int
- func (ipmsg *IPMSG) Myinfo() string
- func (ipmsg *IPMSG) RecvMSG() (*ClientData, error)
- func (ipmsg *IPMSG) SendMSG(addr *net.UDPAddr, msg string, cmd Command) error
- func (ipmsg *IPMSG) UDPAddr() (*net.UDPAddr, error)
- type IPMSGConfig
Constants ¶
View Source
const ( DefaultPort int = 2425 Buflen int = 65535 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientData ¶
type ClientData struct { Version int PacketNum int User string Host string Command Command Option string Nick string Group string Addr *net.UDPAddr ListAddr string Time time.Time PubKey string Encrypt bool Attach bool }
func NewClientData ¶
func NewClientData(msg string, addr *net.UDPAddr) *ClientData
func (ClientData) Key ¶
func (c ClientData) Key() string
func (ClientData) NickName ¶
func (c ClientData) NickName() string
func (*ClientData) Parse ¶
func (c *ClientData) Parse(msg string)
func (*ClientData) String ¶
func (c *ClientData) String() string
func (*ClientData) UpdateNick ¶
func (c *ClientData) UpdateNick()
type Command ¶
type Command int
const ( // COMMAND NOOPERATION Command = 0x00000000 BR_ENTRY Command = 0x00000001 BR_EXIT Command = 0x00000002 ANSENTRY Command = 0x00000003 BR_ABSENCE Command = 0x00000004 BR_ISGETLIST Command = 0x00000010 OKGETLIST Command = 0x00000011 GETLIST Command = 0x00000012 ANSLIST Command = 0x00000013 BR_ISGETLIST2 Command = 0x00000018 SENDMSG Command = 0x00000020 RECVMSG Command = 0x00000021 READMSG Command = 0x00000030 DELMSG Command = 0x00000031 ANSREADMSG Command = 0x00000032 GETINFO Command = 0x00000040 SENDINFO Command = 0x00000041 GETABSENCEINFO Command = 0x00000050 SENDABSENCEINFO Command = 0x00000051 GETFILEDAT Command = 0x00000060 RELEASEFIL Command = 0x00000061 GETDIRFILE Command = 0x00000062 GETPUBKEY Command = 0x00000072 ANSPUBKEY Command = 0x00000073 // MODE MODE Command = 0x000000ff // OPTION //ABSENCE Command = 0x00000100 //SERVER Command = 0x00000200 //DIALUP Command = 0x00010000 SENDCHECK Command = 0x00000100 SECRET Command = 0x00000200 BROADCAST Command = 0x00000400 MULTICAST Command = 0x00000800 NOPOPUP Command = 0x00001000 AUTORET Command = 0x00002000 RETRY Command = 0x00004000 PASSWORD Command = 0x00008000 NOLOG Command = 0x00020000 NEWMUTI Command = 0x00040000 NOADDLIST Command = 0x00080000 READCHECK Command = 0x00100000 FILEATTACH Command = 0x00200000 ENCRYPT Command = 0x00400000 )
type EvFunc ¶
type EvFunc func(cd *ClientData, ipmsg *IPMSG) error
type EventHandler ¶
func NewEventHandler ¶
func NewEventHandler() *EventHandler
func (*EventHandler) Regist ¶
func (ev *EventHandler) Regist(cmd Command, evfunc EvFunc)
func (*EventHandler) Run ¶
func (ev *EventHandler) Run(cd *ClientData, ipmsg *IPMSG) error
func (*EventHandler) RunDebug ¶
func (ev *EventHandler) RunDebug(cd *ClientData)
type IPMSG ¶
type IPMSG struct { ClientData ClientData Conn *net.UDPConn Conf *IPMSGConfig Handlers []*EventHandler PacketNum int }
func NewIPMSG ¶
func NewIPMSG(conf *IPMSGConfig) (*IPMSG, error)
func (*IPMSG) AddEventHandler ¶
func (ipmsg *IPMSG) AddEventHandler(ev *EventHandler)
func (*IPMSG) GetNewPacketNum ¶
func (*IPMSG) RecvMSG ¶
func (ipmsg *IPMSG) RecvMSG() (*ClientData, error)
type IPMSGConfig ¶
type IPMSGConfig struct { NickName string GroupName string UserName string HostName string Port int Local string }
func NewIPMSGConf ¶
func NewIPMSGConf() *IPMSGConfig
Source Files ¶
Click to show internal directories.
Click to hide internal directories.