sip

package
v0.0.0-...-2ace025 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK               = 200
	StatusRequestCancelled = 487
	StatusDecline          = 603
)

Variables

View Source
var (
	ErrInvalidAuthenticationChallenge     = errors.New("invalid authentication challenge")
	ErrUnsolveableAuthenticationChallenge = errors.New("unsolveable authentication challenge")
)
View Source
var (
	ErrInvaldURI = errors.New("invalid uri")
)
View Source
var (
	ErrParsingError = errors.New("error parsing response")
)
View Source
var (
	ErrRoundTripFailed = errors.New("round trip failed")
)

Functions

This section is empty.

Types

type AuthenticationChallenge

type AuthenticationChallenge struct {
	Method     string
	Properties map[string]string
}

type AuthenticationHandler

type AuthenticationHandler interface {
	Solve(challenge AuthenticationChallenge, req *Request) error
}

func NewDigestHandler

func NewDigestHandler(username, password string) AuthenticationHandler

type Connection

type Connection interface {
	Send(*Request) error
	Recv() (*Response, error)
	Close() error
}

type Dialog

type Dialog struct {
	// contains filtered or unexported fields
}

func NewDialog

func NewDialog(transport Transport, caller URI, authenticationHandlers ...AuthenticationHandler) *Dialog

func (*Dialog) Ring

func (d *Dialog) Ring(callee URI, maxRingingTime time.Duration) (bool, error)
type Header map[string][]string

func (Header) Add

func (h Header) Add(key, value string)

func (Header) Contains

func (h Header) Contains(key string) bool

func (Header) DebugString

func (h Header) DebugString() string

func (Header) Get

func (h Header) Get(key string) string

func (Header) ParseHeader

func (h Header) ParseHeader(line string) error

func (Header) Set

func (h Header) Set(key, value string)

func (Header) Write

func (h Header) Write(w io.Writer) error

type Request

type Request struct {
	Method string
	URI    URI
	Header Header
	Body   []byte
}

func NewRequest

func NewRequest(method string, uri URI) *Request

func (*Request) DebugString

func (r *Request) DebugString() string

func (*Request) SetBody

func (r *Request) SetBody(contentType string, body []byte)

func (*Request) Write

func (r *Request) Write(w io.Writer) error

type Response

type Response struct {
	StatusCode            int
	StatusMessage         string
	Protocol              string
	Header                Header
	Body                  []byte
	LocalAddr, RemoteAddr net.Addr
}

func ParseResponse

func ParseResponse(r io.Reader) (*Response, error)

func RecvFinal

func RecvFinal(c Connection) (*Response, error)

func (*Response) DebugString

func (r *Response) DebugString() string

type TCPTransport

type TCPTransport struct {
	DumpRoundTrips bool
}

func (*TCPTransport) Send

func (t *TCPTransport) Send(req *Request) (Connection, error)

type Transport

type Transport interface {
	Send(*Request) (Connection, error)
}

type URI

type URI struct {
	Scheme  string
	Address string
	Host    string
	Port    int
}

func NewURI

func NewURI(scheme, address, host string, port int) URI

func ParseURI

func ParseURI(uri string) (URI, error)

func (URI) String

func (u URI) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL