gosip

package module
v0.0.0-...-798b72c Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: BSD-2-Clause Imports: 13 Imported by: 12 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gosip

SIP stack in Go (RFC 3261)

Build Status Coverage Status

PROJECT IS UNDER DEVELOPMENT

Inspired by:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.0"

Version is the current gosip package version

Functions

This section is empty.

Types

type ClientTransactionCallbacks

type ClientTransactionCallbacks struct {
	OnAck, OnCancel func(sip.Request)
}

type RequestHandler

type RequestHandler func(req sip.Request, tx sip.ServerTransaction)

RequestHandler is a callback that will be called on the incoming request of the certain method tx argument can be nil for 2xx ACK request

type RequestWithContextOption

type RequestWithContextOption interface {
	ApplyRequestWithContext(options *RequestWithContextOptions)
}

func WithAuthorizer

func WithAuthorizer(authorizer sip.Authorizer) RequestWithContextOption

func WithClientTransactionCallbacks

func WithClientTransactionCallbacks(callbacks ClientTransactionCallbacks) RequestWithContextOption

func WithResponseHandler

func WithResponseHandler(handler func(res sip.Response, request sip.Request)) RequestWithContextOption

type RequestWithContextOptions

type RequestWithContextOptions struct {
	ResponseHandler func(res sip.Response, request sip.Request)
	Authorizer      sip.Authorizer
	ClientTransactionCallbacks
}

type Server

type Server interface {
	Shutdown()

	Listen(network, addr string, options ...transport.ListenOption) error
	Send(msg sip.Message) error

	Request(req sip.Request) (sip.ClientTransaction, error)
	RequestWithContext(
		ctx context.Context,
		request sip.Request,
		options ...RequestWithContextOption,
	) (sip.Response, error)
	OnRequest(method sip.RequestMethod, handler RequestHandler) error

	Respond(res sip.Response) (sip.ServerTransaction, error)
	RespondOnRequest(
		request sip.Request,
		status sip.StatusCode,
		reason, body string,
		headers []sip.Header,
	) (sip.ServerTransaction, error)
}

func NewServer

func NewServer(
	config ServerConfig,
	tpFactory TransportLayerFactory,
	txFactory TransactionLayerFactory,
	logger log.Logger,
) Server

NewServer creates new instance of SIP server.

type ServerConfig

type ServerConfig struct {
	// Public IP address or domain name, if empty auto resolved IP will be used.
	Host string
	// Dns is an address of the public DNS server to use in SRV lookup.
	Dns        string
	Extensions []string
	MsgMapper  sip.MessageMapper
	UserAgent  string
}

ServerConfig describes available options

type TransactionLayerFactory

type TransactionLayerFactory func(tpl sip.Transport, logger log.Logger) transaction.Layer

type TransportLayerFactory

type TransportLayerFactory func(
	ip net.IP,
	dnsResolver *net.Resolver,
	msgMapper sip.MessageMapper,
	logger log.Logger,
) transport.Layer

Directories

Path Synopsis
examples
server command
sip
parser
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
transaction package implements SIP Transaction Layer
transaction package implements SIP Transaction Layer
transport package implements SIP transport layer.
transport package implements SIP transport layer.
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Jump to

Keyboard shortcuts

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