Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateAuthorizationResponse(method, username, realm, password, nonce, uri string) string
- type Client
- func (client *Client) Accept() (pkt interface{}, err error)
- func (client *Client) Close() (err error)
- func (client *Client) Dial() (err error)
- func (client *Client) Register() (err error)
- func (client *Client) Request(method string, seq int64, sipaccount string, body []byte, ...) (res <-chan *Response, err error)
- func (client *Client) Write(pkt interface{}) error
- type Cred
- type Handler
- type Message
- func (msg *Message) Accept() *header.Accept
- func (msg *Message) Allow() *header.Allow
- func (msg *Message) Authorization() *header.Authorization
- func (msg *Message) CSeq() *header.CSeq
- func (msg *Message) CallID() *header.CallID
- func (msg *Message) Contact() *header.Contact
- func (msg *Message) ContentLength() *header.ContentLength
- func (msg *Message) ContentType() *header.String
- func (msg *Message) Date() *header.Date
- func (msg *Message) Expires() *header.Expires
- func (msg *Message) From() *header.From
- func (msg *Message) Marshal() []byte
- func (msg *Message) MaxForwards() *header.MaxForwards
- func (msg *Message) SetAccept(val *header.Accept)
- func (msg *Message) SetAllow(val *header.Allow)
- func (msg *Message) SetAuthorization(val *header.Authorization)
- func (msg *Message) SetCSeq(val *header.CSeq)
- func (msg *Message) SetCallID(val *header.CallID)
- func (msg *Message) SetContact(val *header.Contact)
- func (msg *Message) SetContentLength(val *header.ContentLength)
- func (msg *Message) SetContentType(val *header.String)
- func (msg *Message) SetDate(val *header.Date)
- func (msg *Message) SetExpires(val *header.Expires)
- func (msg *Message) SetFrom(val *header.From)
- func (msg *Message) SetMaxForwards(val *header.MaxForwards)
- func (msg *Message) SetTo(val *header.To)
- func (msg *Message) SetVia(val *header.Via)
- func (msg *Message) SetWWWAuthenticate(val *header.WWWAuthenticate)
- func (msg *Message) To() *header.To
- func (msg *Message) Unmarshal(b []byte) error
- func (msg *Message) Via() *header.Via
- func (msg *Message) WWWAuthenticate() *header.WWWAuthenticate
- type Request
- type Response
- type Server
Constants ¶
View Source
const ( CR = '\r' LF = '\n' )
View Source
const ( MethodRegister = "REGISTER" MethodInvite = "INVITE" MethodCancel = "CANCEL" MethodAck = "ACK" MethodBye = "BYE" MethodOptions = "OPTIONS" MethodOther = "OTHER" MethodMessage = "MESSAGE" )
View Source
const (
OK = 200
)
Variables ¶
View Source
var ErrClientClosed = fmt.Errorf("client be closed")
View Source
var ErrClientNotConnected = fmt.Errorf("client is not connected")
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type Cred ¶
type Cred struct { Username string Realm string // Realm. Use "*" to make a credential that can be used to authenticate against any challenges. Scheme string // Scheme (e.g. "digest"). DataType int //Type of data (0 for plaintext passwd). Data string // The data, which can be a plaintext password or a hashed digest. }
type Handler ¶
type Handler interface { OnRequest(conn xnet.Conn, req *Request) OnResponse(conn xnet.Conn, res *Response) }
A Handler responds to an HTTP request.
type Message ¶
type Message struct { Headers map[string]header.HeaderValue Body []byte }
Message sip message
func NewMessage ¶
func NewMessage() *Message
func (*Message) Authorization ¶
func (msg *Message) Authorization() *header.Authorization
func (*Message) ContentLength ¶
func (msg *Message) ContentLength() *header.ContentLength
func (*Message) ContentType ¶
func (*Message) MaxForwards ¶
func (msg *Message) MaxForwards() *header.MaxForwards
func (*Message) SetAuthorization ¶
func (msg *Message) SetAuthorization(val *header.Authorization)
func (*Message) SetContact ¶
func (*Message) SetContentLength ¶
func (msg *Message) SetContentLength(val *header.ContentLength)
func (*Message) SetContentType ¶
func (*Message) SetExpires ¶
func (*Message) SetMaxForwards ¶
func (msg *Message) SetMaxForwards(val *header.MaxForwards)
func (*Message) SetWWWAuthenticate ¶
func (msg *Message) SetWWWAuthenticate(val *header.WWWAuthenticate)
func (*Message) WWWAuthenticate ¶
func (msg *Message) WWWAuthenticate() *header.WWWAuthenticate
type Request ¶
type Request struct { *Message Method string Protocal *header.Protocal URI *header.URI LocalAddr net.Addr RemoteAddr net.Addr // contains filtered or unexported fields }
A Request represents an SIP request received by a server or to be sent by a client.
func NewRequest ¶
func NewRequest() *Request
type Response ¶
type Response struct { *Message Protocal *header.Protocal StatusCode int Reason string // contains filtered or unexported fields }
Response sip response
func AuthSrvChallenge ¶
func NewResponse ¶
func NewResponse() *Response
func NewResponseWithStatus ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.