Documentation ¶
Index ¶
- Constants
- func CreateTcpTls(host string, msg *SipMsg, isSSL bool)
- func CreateWsWss(host string, msg *SipMsg, isSSL bool)
- func GetRemote(ctype Transport, conn interface{}) net.Addr
- func LocalIps() []net.IP
- func ParseSip()
- func StreamClient(conn interface{}, firstmsg *SipMsg, isws bool, isSSL bool) error
- func UdpMain(ip string, port int)
- func WSSServer(cfg *SipConfig)
- func WSServer(cfg *SipConfig)
- type ClientInfo
- type ClientMgr
- func (mgr *ClientMgr) Add(msg *CreateMsg) error
- func (mgr *ClientMgr) Receive(id UUID, msg *SipMsg) error
- func (mgr *ClientMgr) ReceiveRequest(id UUID, msg *SipMsg) error
- func (mgr *ClientMgr) ReceiveResponse(id UUID, msg *SipMsg) error
- func (mgr *ClientMgr) Remove(id UUID) error
- func (mgr *ClientMgr) Run() error
- func (mgr *ClientMgr) Send(id UUID, proto Transport, remote string, msg *SipMsg) error
- type ConnectionType
- type Contact
- type CreateMsg
- type DestroyMsg
- type FromTo
- type Method
- type MgrConfig
- type PacketRecvMsg
- type PacketSendMsg
- type Proxy
- type Route
- type SipConfig
- type SipMsg
- func (msg *SipMsg) AddTopVia(v *Via) error
- func (msg *SipMsg) Contact() *Contact
- func (msg *SipMsg) Decode() error
- func (msg *SipMsg) Encode() ([]byte, error)
- func (msg *SipMsg) FirstLine() string
- func (msg *SipMsg) FromTag() string
- func (msg *SipMsg) IsRequest() bool
- func (msg *SipMsg) Method() Method
- func (msg *SipMsg) OrigMsg() string
- func (msg *SipMsg) RecvAddr() string
- func (msg *SipMsg) RemoveTopRoute() error
- func (msg *SipMsg) RemoveTopVia() error
- func (msg *SipMsg) SetContact(c *Contact) error
- func (msg *SipMsg) SetFirstLine(s string)
- func (msg *SipMsg) SetRecvAddr(addr string) error
- func (msg *SipMsg) SipUri() string
- func (msg *SipMsg) String() string
- func (msg *SipMsg) ToUserName() string
- func (msg *SipMsg) TopRoute() (*Route, error)
- func (msg *SipMsg) TopVia() (*Via, error)
- type SipMsgCodec
- type SipMsgCollecter
- type SipRoute
- type StatusMsg
- type Transport
- type UUID
- type Via
- type ViaKey
Constants ¶
View Source
const SipConfigName string = "ztesip.ini"
Variables ¶
This section is empty.
Functions ¶
func CreateTcpTls ¶
func CreateWsWss ¶
func StreamClient ¶
Types ¶
type ClientInfo ¶
type ClientInfo struct { ID UUID ConnType Transport //proto should be UDP/TCP/TLS/WS/WSS PeerAddr string //ip:port PacketSendCh chan *PacketSendMsg //接收数据通道 ExitCh chan interface{} //接收退出消息通道 }
type ClientMgr ¶
type ClientMgr struct { LocalIP string //local ip UdpPort int Clients map[UUID]*ClientInfo //ID ViaTable map[ViaKey]UUID NameTable map[string]UUID //when called,we can use user name to uuid[callee] Route map[*regexp.Regexp]*Proxy UdpID UUID Cfg *MgrConfig //config SipCfg *SipConfig }
func NewClientMgr ¶
func (*ClientMgr) ReceiveResponse ¶
type ConnectionType ¶
type ConnectionType int
const ( Udp ConnectionType = 1 << iota Tcp Tls Ws Wss Sctp )
type Contact ¶
type Contact struct { Displayname string Username string Domain string Transport Transport Expires int }
Contact: <sip:bpe4fc20@ha0af4gnfvl8.invalid;transport=ws>; expires=300;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:93d317d6-3e58-42d1-a456-b56e1b30e33f>"
func NewContact ¶
func ParseContact ¶
type CreateMsg ¶
type CreateMsg struct { ID UUID ConnType Transport PeerAddr string //*net.TCPAddr PacketSendCh chan *PacketSendMsg //客户端构建,主控可以向该通道发送数据 ExitCh chan interface{} //主控发送退出消息到客户端 }
type DestroyMsg ¶
type DestroyMsg struct {
ID UUID
}
type MgrConfig ¶
type MgrConfig struct { CreateCh chan *CreateMsg //主控接收创建 DestroyCh chan *DestroyMsg //主控接收销毁 PacketRecvCh chan *PacketRecvMsg //主控接收数据通道 StatusCh chan *StatusMsg //主控接收状态数据 }
var Config *MgrConfig
func NewMgrConfig ¶
func NewMgrConfig() *MgrConfig
type PacketRecvMsg ¶
type PacketSendMsg ¶
type Route ¶
func ParseRoute ¶
type SipConfig ¶
type SipConfig struct { Home string MaxLinkNum int HttpPort int HttpsPort int UdpPort int TcpPort int TlsPort int WsPort int WssPort int XmlPort int CertFileName string KeyFileName string LogLevel int LogPath string Route map[string]*SipRoute RouteOrder []string // contains filtered or unexported fields }
func NewSipConfig ¶
func (*SipConfig) RemoveRoute ¶
type SipMsg ¶
type SipMsg struct {
// contains filtered or unexported fields
}
func (*SipMsg) RemoveTopRoute ¶
func (*SipMsg) RemoveTopVia ¶
func (*SipMsg) SetContact ¶
func (*SipMsg) SetFirstLine ¶
func (*SipMsg) SetRecvAddr ¶
func (*SipMsg) ToUserName ¶
type SipMsgCodec ¶
type SipMsgCollecter ¶
type SipMsgCollecter struct {
// contains filtered or unexported fields
}
func (*SipMsgCollecter) Add ¶
func (c *SipMsgCollecter) Add(data []byte) error
func (*SipMsgCollecter) Count ¶
func (c *SipMsgCollecter) Count() int
func (*SipMsgCollecter) Remove ¶
func (c *SipMsgCollecter) Remove() (*SipMsg, error)
type SipRoute ¶
type SipRoute struct { IsPrefix bool Ip string Port int Proto Transport Rule string //userno@domain ^userno or domain$ Username string Password string }
10.114.70.166 = *;ccm1000.zte.com.cn[;udp:5060[;user;pwd]]
func NewSipRoute ¶
func NewSipRoute() *SipRoute
Click to show internal directories.
Click to hide internal directories.