goczmq: github.com/zeromq/goczmq Index | Examples | Files

package goczmq

import "github.com/zeromq/goczmq"

Package goczmq is a golang binding for CZMQ 3. CZMQ is a high level binding for ZeroMQ. Along with ZeroMQ socket support, CZMQ provides "actor" based services for authentication, service discovery, and creating proxies. GoCZMQ provides direct bindings to CZMQ along with higher level go abstractions such as channels and io.ReadWriter interface support.

"Tell them I was a writer.

A maker of software.
A humanist. A father.
And many things.
But above all, a writer.
Thank You. :)
- Pieter Hintjens

go:generate gsl sockopts.xml

Index

Examples

Package Files

auth.go beacon.go cert.go certstore.go channeler.go goczmq.go poller.go proxy.go readwriter.go sock.go sock_option.go test_utils.go

Constants

const (
    // Req is a ZMQ_REQ socket type
    Req = int(C.ZMQ_REQ)

    // Rep is a ZMQ_REP socket type
    Rep = int(C.ZMQ_REP)

    // Dealer is a ZMQ_DEALER socket type
    Dealer = int(C.ZMQ_DEALER)

    // Router is a ZMQ_ROUTER socket type
    Router = int(C.ZMQ_ROUTER)

    // Pub is a ZMQ_PUB socket type
    Pub = int(C.ZMQ_PUB)

    // Sub is a ZMQ_SUB socket type
    Sub = int(C.ZMQ_SUB)

    // XPub is a ZMQ_XPUB socket type
    XPub = int(C.ZMQ_XPUB)

    // XSub is a ZMQ_XSUB socket type
    XSub = int(C.ZMQ_XSUB)

    // Push is a ZMQ_PUSH socket type
    Push = int(C.ZMQ_PUSH)

    // Pull is a ZMQ_PULL socket type
    Pull = int(C.ZMQ_PULL)

    // Pair is a ZMQ_PAIR socket type
    Pair = int(C.ZMQ_PAIR)

    // Stream is a ZMQ_STREAM socket type
    Stream = int(C.ZMQ_STREAM)

    // Pollin is the ZMQ_POLLIN constant
    Pollin = int(C.ZMQ_POLLIN)

    // Pollout is the ZMQ_POLLOUT constant
    Pollout = int(C.ZMQ_POLLOUT)

    // FlagMore is the ZFRAME_MORE flag
    FlagMore = int(C.ZFRAME_MORE)

    // FlagReuse is the ZFRAME_REUSE flag
    FlagReuse = int(C.ZFRAME_REUSE)

    //FlagDontWait is the ZFRAME_DONTWAIT flag
    FlagDontWait = int(C.ZFRAME_DONTWAIT)

    //FlagNone means there are no flags
    FlagNone = 0

    // CurveAllowAny is a semantic convenience for allowing
    // any Curve clients
    CurveAllowAny = "*"

    //ZMQVersionMajor is the major version of the underlying ZeroMQ library
    ZMQVersionMajor = int(C.ZMQ_VERSION_MAJOR)

    //ZMQVersionMinor is the minor version of the underlying ZeroMQ library
    ZMQVersionMinor = int(C.ZMQ_VERSION_MINOR)

    //CZMQVersionMajor is the major version of the underlying CZMQ library
    CZMQVersionMajor = int(C.CZMQ_VERSION_MAJOR)

    // CZMQVersionMinor is the minor version of the underlying CZMQ library
    CZMQVersionMinor = int(C.CZMQ_VERSION_MINOR)
)

Variables

var (
    // ErrActorCmd is returned when there is an error sending
    // a command to an actor
    ErrActorCmd = errors.New("error sending actor command")

    // ErrSockAttach is returned when an attach call to a socket fails
    ErrSockAttach = errors.New("error attaching zsock")

    // ErrSockAttachEmptyEndpoints is returned when the endpoints value is empty
    ErrSockAttachEmptyEndpoints = errors.New("Endpoints cannot be empty")

    // ErrInvalidSockType is returned when a function is called
    // against a socket type that is not applicable for that socket type
    ErrInvalidSockType = errors.New("invalid socket type")

    // ErrSliceFull is returned if a []byte passed to Read was not
    // large enough to hold the contents of a message
    ErrSliceFull = errors.New("slice full")

    // ErrConnect is returned if Connect on a socket fails
    ErrConnect = errors.New("connect error")

    // ErrDisconnect is returned if Disconnect on a socket fails
    ErrDisconnect = errors.New("disconnect error")

    // ErrBind is returned if Bind on a socket fails
    ErrBind = errors.New("bind error")

    // ErrUnbind is returned if Unbind on a socket fails
    ErrUnbind = errors.New("unbind error")

    // ErrSendFrame is returned if SendFrame on a socket fails
    ErrSendFrame = errors.New("send frame error")

    // ErrRecvFrame is returned if RecvFrame on a socket fails
    ErrRecvFrame = errors.New("recv frame error")

    // ErrRecvFrameAfterDestroy is returned if RecvFrame is called
    // on a socket after it has been destroyed.
    ErrRecvFrameAfterDestroy = errors.New("RecvFrame() is invalid on socket after Detroy() has been called.")

    // ErrRecvMessage is returned if RecvMessage on a socket fails
    ErrRecvMessage = errors.New("recv message error")

    // ErrWaitAfterDestroy is returned by a Poller if there is an error
    // accessing the underlying socket pointer when Wait is called
    ErrWaitAfterDestroy = errors.New("Wait() is invalid on Poller after Destroy() is called.")

    // ErrMultiPartUnsupported is returned when a function that does
    // not support multi-part messages encounters a multi-part message
    ErrMultiPartUnsupported = errors.New("function does not support multi part messages")

    // ErrTimeout is returned when a function that supports timeouts times out
    ErrTimeout = errors.New("function timed out")

    // ErrCertNotFound is returned when NewCertFromFile tries to
    // load a file that does not exist.
    ErrCertNotFound = errors.New("file not found")
)

func Affinity Uses

func Affinity(s *Sock) int

Affinity returns the current value of the socket's affinity option

func Backlog Uses

func Backlog(s *Sock) int

Backlog returns the current value of the socket's backlog option

func ConnectTimeout Uses

func ConnectTimeout(s *Sock) int

ConnectTimeout returns the current value of the socket's connect_timeout option

func CurvePublickey Uses

func CurvePublickey(s *Sock) string

CurvePublickey returns the current value of the socket's curve_publickey option

func CurveSecretkey Uses

func CurveSecretkey(s *Sock) string

CurveSecretkey returns the current value of the socket's curve_secretkey option

func CurveServer Uses

func CurveServer(s *Sock) int

CurveServer returns the current value of the socket's curve_server option

func CurveServerkey Uses

func CurveServerkey(s *Sock) string

CurveServerkey returns the current value of the socket's curve_serverkey option

func Events Uses

func Events(s *Sock) int

Events returns the current value of the socket's events option

func Fd Uses

func Fd(s *Sock) int

Fd returns the current value of the socket's fd option

func GssapiPlaintext Uses

func GssapiPlaintext(s *Sock) int

GssapiPlaintext returns the current value of the socket's gssapi_plaintext option

func GssapiPrincipal Uses

func GssapiPrincipal(s *Sock) string

GssapiPrincipal returns the current value of the socket's gssapi_principal option

func GssapiServer Uses

func GssapiServer(s *Sock) int

GssapiServer returns the current value of the socket's gssapi_server option

func GssapiServicePrincipal Uses

func GssapiServicePrincipal(s *Sock) string

GssapiServicePrincipal returns the current value of the socket's gssapi_service_principal option

func HandshakeIvl Uses

func HandshakeIvl(s *Sock) int

HandshakeIvl returns the current value of the socket's handshake_ivl option

func HeartbeatIvl Uses

func HeartbeatIvl(s *Sock) int

HeartbeatIvl returns the current value of the socket's heartbeat_ivl option

func HeartbeatTimeout Uses

func HeartbeatTimeout(s *Sock) int

HeartbeatTimeout returns the current value of the socket's heartbeat_timeout option

func HeartbeatTtl Uses

func HeartbeatTtl(s *Sock) int

HeartbeatTtl returns the current value of the socket's heartbeat_ttl option

func Identity Uses

func Identity(s *Sock) string

Identity returns the current value of the socket's identity option

func Immediate Uses

func Immediate(s *Sock) int

Immediate returns the current value of the socket's immediate option

func InvertMatching Uses

func InvertMatching(s *Sock) int

InvertMatching returns the current value of the socket's invert_matching option

func Ipv4only Uses

func Ipv4only(s *Sock) int

Ipv4only returns the current value of the socket's ipv4only option

func Ipv6 Uses

func Ipv6(s *Sock) int

Ipv6 returns the current value of the socket's ipv6 option

func LastEndpoint Uses

func LastEndpoint(s *Sock) string

LastEndpoint returns the current value of the socket's last_endpoint option

func Linger Uses

func Linger(s *Sock) int

Linger returns the current value of the socket's linger option

func Maxmsgsize Uses

func Maxmsgsize(s *Sock) int

Maxmsgsize returns the current value of the socket's maxmsgsize option

func Mechanism Uses

func Mechanism(s *Sock) int

Mechanism returns the current value of the socket's mechanism option

func MulticastHops Uses

func MulticastHops(s *Sock) int

MulticastHops returns the current value of the socket's multicast_hops option

func MulticastMaxtpdu Uses

func MulticastMaxtpdu(s *Sock) int

MulticastMaxtpdu returns the current value of the socket's multicast_maxtpdu option

func PlainPassword Uses

func PlainPassword(s *Sock) string

PlainPassword returns the current value of the socket's plain_password option

func PlainServer Uses

func PlainServer(s *Sock) int

PlainServer returns the current value of the socket's plain_server option

func PlainUsername Uses

func PlainUsername(s *Sock) string

PlainUsername returns the current value of the socket's plain_username option

func Rate Uses

func Rate(s *Sock) int

Rate returns the current value of the socket's rate option

func Rcvbuf Uses

func Rcvbuf(s *Sock) int

Rcvbuf returns the current value of the socket's rcvbuf option

func Rcvhwm Uses

func Rcvhwm(s *Sock) int

Rcvhwm returns the current value of the socket's rcvhwm option

func Rcvmore Uses

func Rcvmore(s *Sock) int

Rcvmore returns the current value of the socket's rcvmore option

func Rcvtimeo Uses

func Rcvtimeo(s *Sock) int

Rcvtimeo returns the current value of the socket's rcvtimeo option

func ReconnectIvl Uses

func ReconnectIvl(s *Sock) int

ReconnectIvl returns the current value of the socket's reconnect_ivl option

func ReconnectIvlMax Uses

func ReconnectIvlMax(s *Sock) int

ReconnectIvlMax returns the current value of the socket's reconnect_ivl_max option

func RecoveryIvl Uses

func RecoveryIvl(s *Sock) int

RecoveryIvl returns the current value of the socket's recovery_ivl option

func Shutdown Uses

func Shutdown()

Shutdown shuts down the CZMQ zsys layer. The CZMQ zsys layer normally shuts down on process termination through the use of an atexit cleanup function. Calling this allows the zsys layer to be shutdown manually.

This is beneficial when CZMQ will no longer be used but the process will not be terminating. Any potential resources allocated by the zsys layer can be freed as they will no longer be needed.

func Sndbuf Uses

func Sndbuf(s *Sock) int

Sndbuf returns the current value of the socket's sndbuf option

func Sndhwm Uses

func Sndhwm(s *Sock) int

Sndhwm returns the current value of the socket's sndhwm option

func Sndtimeo Uses

func Sndtimeo(s *Sock) int

Sndtimeo returns the current value of the socket's sndtimeo option

func SocksProxy Uses

func SocksProxy(s *Sock) string

SocksProxy returns the current value of the socket's socks_proxy option

func TcpAcceptFilter Uses

func TcpAcceptFilter(s *Sock) string

TcpAcceptFilter returns the current value of the socket's tcp_accept_filter option

func TcpKeepalive Uses

func TcpKeepalive(s *Sock) int

TcpKeepalive returns the current value of the socket's tcp_keepalive option

func TcpKeepaliveCnt Uses

func TcpKeepaliveCnt(s *Sock) int

TcpKeepaliveCnt returns the current value of the socket's tcp_keepalive_cnt option

func TcpKeepaliveIdle Uses

func TcpKeepaliveIdle(s *Sock) int

TcpKeepaliveIdle returns the current value of the socket's tcp_keepalive_idle option

func TcpKeepaliveIntvl Uses

func TcpKeepaliveIntvl(s *Sock) int

TcpKeepaliveIntvl returns the current value of the socket's tcp_keepalive_intvl option

func TcpMaxrt Uses

func TcpMaxrt(s *Sock) int

TcpMaxrt returns the current value of the socket's tcp_maxrt option

func ThreadSafe Uses

func ThreadSafe(s *Sock) int

ThreadSafe returns the current value of the socket's thread_safe option

func Tos Uses

func Tos(s *Sock) int

Tos returns the current value of the socket's tos option

func Type Uses

func Type(s *Sock) int

Type returns the current value of the socket's type option

func UseFd Uses

func UseFd(s *Sock) int

UseFd returns the current value of the socket's use_fd option

func VmciBufferMaxSize Uses

func VmciBufferMaxSize(s *Sock) int

VmciBufferMaxSize returns the current value of the socket's vmci_buffer_max_size option

func VmciBufferMinSize Uses

func VmciBufferMinSize(s *Sock) int

VmciBufferMinSize returns the current value of the socket's vmci_buffer_min_size option

func VmciBufferSize Uses

func VmciBufferSize(s *Sock) int

VmciBufferSize returns the current value of the socket's vmci_buffer_size option

func VmciConnectTimeout Uses

func VmciConnectTimeout(s *Sock) int

VmciConnectTimeout returns the current value of the socket's vmci_connect_timeout option

func ZapDomain Uses

func ZapDomain(s *Sock) string

ZapDomain returns the current value of the socket's zap_domain option

type Auth Uses

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

Auth wraps the CZMQ zauth actor. It handles authentication for all incoming connections. It allows whitelisting and blackisting peers based on IP address and support PLAIN and CURVE authentication policies.

Code:

// create a server certificate
serverCert := NewCert()
defer serverCert.Destroy()

// create a client certificate and save it
clientCert := NewCert()
defer clientCert.Destroy()
err := clientCert.SavePublic("client_cert")
if err != nil {
    panic(err)
}

defer func() {
    err := os.Remove("client_cert")
    if err != nil {
        if err != nil {
            panic(err)
        }
    }
}()

// create an auth service
auth := NewAuth()
defer auth.Destroy()

// tell the auth service the client cert is allowed
err = auth.Curve("client_cert")
if err != nil {
    panic(err)
}

// create a server socket and set it to
// use the "global" auth domain
server := NewSock(Push, SockSetZapDomain("global"))
defer server.Destroy()

// set the server cert as the server cert
// for the socket we created and set it
// to be a curve server
serverCert.Apply(server)
server.SetOption(SockSetCurveServer(1))

// bind our server to an endpoint
_, err = server.Bind("tcp://*:9898")
if err != nil {
    panic(err)
}

// create a client socket
client := NewSock(Pull)
defer client.Destroy()

// assign the client cert we made to the client
clientCert.Apply(client)

// set the server cert as the server cert
// for the client. for the client to be
// allowed to connect, it needs to know
// the servers public cert.
client.SetOption(SockSetCurveServerkey(serverCert.PublicText()))

// connect
err = client.Connect("tcp://127.0.0.1:9898")
if err != nil {
    panic(err)
}

func NewAuth Uses

func NewAuth() *Auth

NewAuth creates a new Auth actor.

func (*Auth) Allow Uses

func (a *Auth) Allow(address string) error

Allow removes a previous Deny

func (*Auth) Curve Uses

func (a *Auth) Curve(allowed string) error

Curve sets auth method to curve

func (*Auth) Deny Uses

func (a *Auth) Deny(address string) error

Deny adds an address to a socket's deny list

func (*Auth) Destroy Uses

func (a *Auth) Destroy()

Destroy destroys the auth actor.

func (*Auth) Plain Uses

func (a *Auth) Plain(directory string) error

Plain sets auth method to plain

func (*Auth) Verbose Uses

func (a *Auth) Verbose() error

Verbose sets the auth actor to log information to stdout.

type Beacon Uses

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

Beacon wraps the CZMQ beacon actor. It implements a peer-to-peer discovery service for local networks. Beacons can broadcast and receive UDPv4 service broadcasts.

Code:

beacon := NewBeacon()
defer beacon.Destroy()

address, err := beacon.Configure(9999)
if err != nil {
    panic(err)
}

fmt.Printf("started beacon on: %s", address)

err = beacon.Publish("HI", 100)
if err != nil {
    panic(err)
}

func NewBeacon Uses

func NewBeacon() *Beacon

NewBeacon creates a new Beacon instance.

func (*Beacon) Configure Uses

func (b *Beacon) Configure(port int) (string, error)

Configure accepts a port number and configures the beacon, returning an address

func (*Beacon) Destroy Uses

func (b *Beacon) Destroy()

Destroy destroys the beacon.

func (*Beacon) Publish Uses

func (b *Beacon) Publish(announcement string, interval int) error

Publish publishes an announcement string at an interval

func (*Beacon) PublishBytes Uses

func (b *Beacon) PublishBytes(announcement []byte, interval int) error

PublishBytes publishes an announcement byte slice at an interval

func (*Beacon) Recv Uses

func (b *Beacon) Recv(timeout int) [][]byte

Recv waits for the specific timeout in milliseconds to receive a beacon

func (*Beacon) Subscribe Uses

func (b *Beacon) Subscribe(filter string) error

Subscribe subscribes to beacons matching the filter

func (*Beacon) Verbose Uses

func (b *Beacon) Verbose() error

Verbose sets the beacon to log information to stdout.

type Cert Uses

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

Cert wraps the CZMQ zcert class. It provides tools for creating and working with ZMQ CURVE security certs. The certs can be used as a temporary object in memory or persisted to disk. Certs are made up of a public and secret keypair + metadata.

Code:

cert := NewCert()
defer cert.Destroy()
cert.SetMeta("email", "taotetek@gmail.com")
cert.SetMeta("name", "Brian Knox")
cert.SetMeta("organization", "ZeroMQ")

func NewCert Uses

func NewCert() *Cert

NewCert creates a new empty Cert instance

func NewCertFromFile Uses

func NewCertFromFile(filename string) (*Cert, error)

NewCertFromFile Load loads a Cert from files

func NewCertFromKeys Uses

func NewCertFromKeys(public []byte, secret []byte) (*Cert, error)

NewCertFromKeys creates a new Cert from a public and private key

func (*Cert) Apply Uses

func (c *Cert) Apply(s *Sock)

Apply sets the public and private keys for a socket

func (*Cert) Destroy Uses

func (c *Cert) Destroy()

Destroy destroys Cert instance

func (*Cert) Dup Uses

func (c *Cert) Dup() *Cert

Dup duplicates a Cert

func (*Cert) Equal Uses

func (c *Cert) Equal(compare *Cert) bool

Equal checks two Certs for equality

func (*Cert) Meta Uses

func (c *Cert) Meta(key string) string

Meta returns a meta data item from a Cert given a key

func (*Cert) Print Uses

func (c *Cert) Print()

Print prints a Cert to stdout

func (*Cert) PublicText Uses

func (c *Cert) PublicText() string

PublicText returns the public key as a string

func (*Cert) Save Uses

func (c *Cert) Save(filename string) error

Save saves the public and secret key to filename and filename_secret

func (*Cert) SavePublic Uses

func (c *Cert) SavePublic(filename string) error

SavePublic saves the public key to a file

func (*Cert) SaveSecret Uses

func (c *Cert) SaveSecret(filename string) error

SaveSecret saves the secret key to a file

func (*Cert) SetMeta Uses

func (c *Cert) SetMeta(key string, value string)

SetMeta sets meta data for a Cert

type CertStore Uses

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

func NewCertStore Uses

func NewCertStore(location string) *CertStore

NewCertStore creates a new certificate store from a disk directory, loading and indexing all certificates.

func (*CertStore) Destroy Uses

func (c *CertStore) Destroy()

Destroy destroys Cert instance

func (*CertStore) Insert Uses

func (c *CertStore) Insert(cert *Cert)

Insert inserts a certificate into the store in memory. Call Save directly on the cert if you wish to save it to disk.

func (*CertStore) Lookup Uses

func (c *CertStore) Lookup(key string) *Cert

Lookup looks up a certificate in the store by public key and returns it.

func (*CertStore) Print Uses

func (c *CertStore) Print()

Print prints a list of certificates in the store to stdout

type Channeler Uses

type Channeler struct {
    SendChan chan<- [][]byte
    RecvChan <-chan [][]byte
    ErrChan  <-chan error
    // contains filtered or unexported fields
}

Channeler serializes all access to a socket through a send and receive channel. It starts two threads, on is used for receiving from the zeromq socket. The other is used to listen to the receive channel, and send everything back to the socket thrad for sending using an additional inproc socket.

Code:

// create a dealer channeler
dealer := NewDealerChanneler("inproc://channelerdealerrouter")
defer dealer.Destroy()

// create a router channeler
router := NewRouterChanneler("inproc://channelerdealerrouter")
defer router.Destroy()

// send a hello message
dealer.SendChan <- [][]byte{[]byte("Hello")}

// receive the hello message
request := <-router.RecvChan

// first frame is identity of client - let's append 'World'
// to the message and route it back
request = append(request, []byte("World"))

// send the reply
router.SendChan <- request

// receive the reply
reply := <-dealer.RecvChan

fmt.Printf("%s %s", string(reply[0]), string(reply[1]))

Output:

Hello World

func NewDealerChanneler Uses

func NewDealerChanneler(endpoints string, options ...SockOption) *Channeler

NewDealerChanneler creates a new Channeler wrapping a Dealer socket. The socket will connect by default.

func NewPairChanneler Uses

func NewPairChanneler(endpoints string, options ...SockOption) *Channeler

NewPairChanneler creates a new Channeler wrapping a Pair socket. The socket will connect by default.

func NewPubChanneler Uses

func NewPubChanneler(endpoints string, options ...SockOption) *Channeler

NewPubChanneler creats a new Channeler wrapping a Pub socket. The socket will bind by default.

func NewPullChanneler Uses

func NewPullChanneler(endpoints string, options ...SockOption) *Channeler

NewPullChanneler creates a new Channeler wrapping a Pull socket. The socket will bind by default.

func NewPushChanneler Uses

func NewPushChanneler(endpoints string, options ...SockOption) *Channeler

NewPushChanneler creates a new Channeler wrapping a Push socket. The socket will connect by default.

func NewRepChanneler Uses

func NewRepChanneler(endpoints string, options ...SockOption) *Channeler

NewRepChanneler creates a new Channeler wrapping a Rep socket. The socket will bind by default.

func NewReqChanneler Uses

func NewReqChanneler(endpoints string, options ...SockOption) *Channeler

NewReqChanneler creates a new Channeler wrapping a Req socket. The socket will connect by default.

func NewRouterChanneler Uses

func NewRouterChanneler(endpoints string, options ...SockOption) *Channeler

NewRouterChanneler creates a new Channeler wrapping a Router socket. The socket will Bind by default.

func NewStreamChanneler Uses

func NewStreamChanneler(endpoints string, options ...SockOption) *Channeler

NewStreamChanneler creates a new Channeler wrapping a Pair socket. The socket will connect by default.

func NewSubChanneler Uses

func NewSubChanneler(endpoints string, varargs ...interface{}) *Channeler

NewSubChanneler creates a new Channeler wrapping a Sub socket. Along with an endpoint list it accepts a list of topics and/or socket options (discriminated by type). The socket will connect by default.

func NewXPubChanneler Uses

func NewXPubChanneler(endpoints string, options ...SockOption) *Channeler

NewXPubChanneler creates a new Channeler wrapping an XPub socket. The socket will Bind by default.

func NewXSubChanneler Uses

func NewXSubChanneler(endpoints string, options ...SockOption) *Channeler

NewXSubChanneler creates a new Channeler wrapping a XSub socket. The socket will connect by default.

func (*Channeler) Destroy Uses

func (c *Channeler) Destroy()

Destroy sends a message to the Channeler to shut it down and clean it up.

func (*Channeler) Subscribe Uses

func (c *Channeler) Subscribe(topic string)

Subscribe to a Topic

func (*Channeler) Unsubscribe Uses

func (c *Channeler) Unsubscribe(topic string)

Unsubscribe from a Topic

type Poller Uses

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

Poller provides a simple wrapper to ZeroMQ's zmq_poll API, for the common case of reading from a number of sockets. Sockets can be added and removed from the running poller.

Code:

sock1, err := NewRouter("inproc://poller_example_1")
if err != nil {
    panic(err)
}
defer sock1.Destroy()

poller, err := NewPoller(sock1)
if err != nil {
    panic(err)
}

sock2, err := NewRouter("inproc://poller_example_2")
if err != nil {
    panic(err)
}
defer sock2.Destroy()

err = poller.Add(sock2)
if err != nil {
    panic(err)
}

// Poller.Wait(millis) returns first socket that has a waiting message
poller.Wait(1)

func NewPoller Uses

func NewPoller(readers ...*Sock) (*Poller, error)

NewPoller creates a new Poller instance. It accepts one or more readers to poll.

func (*Poller) Add Uses

func (p *Poller) Add(reader *Sock) error

Add adds a reader to be polled.

func (*Poller) Destroy Uses

func (p *Poller) Destroy()

Destroy destroys the Poller

func (*Poller) Remove Uses

func (p *Poller) Remove(reader *Sock)

Remove removes a Sock from the poller

func (*Poller) Wait Uses

func (p *Poller) Wait(millis int) (*Sock, error)

Wait waits for the timeout period in milliseconds for a Pollin event, and returns the first socket that returns one

type Proxy Uses

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

Proxy wraps the CZMQ zproxy actor. A proxy actor switches messages between a frontend and backend socket, and also provides an optional capture socket messages can be mirrored to. The proxy can be paused and resumed.

Code:

proxy := NewProxy()
defer proxy.Destroy()

// set front end address and socket type
err := proxy.SetFrontend(Pull, "inproc://frontend")
if err != nil {
    panic(err)
}

// set back end address and socket type
err = proxy.SetBackend(Push, "inproc://backend")
if err != nil {
    panic(err)
}

// set address for "tee"ing proxy traffic to
err = proxy.SetCapture("inproc://capture")
if err != nil {
    panic(err)
}

// we can pause the proxy
err = proxy.Pause()
if err != nil {
    panic(err)
}

// and we can resume it
err = proxy.Resume()
if err != nil {
    panic(err)
}

proxy.Destroy()

func NewProxy Uses

func NewProxy() *Proxy

NewProxy creates a new Proxy instance.

func (*Proxy) Destroy Uses

func (p *Proxy) Destroy()

Destroy destroys the proxy.

func (*Proxy) Pause Uses

func (p *Proxy) Pause() error

Pause sends a message to the zproxy actor telling it to pause.

func (*Proxy) Resume Uses

func (p *Proxy) Resume() error

Resume sends a message to the zproxy actor telling it to resume.

func (*Proxy) SetBackend Uses

func (p *Proxy) SetBackend(sockType int, endpoint string) error

SetBackend accepts a socket type and endpoint, and sends a message to the zactor thread telling it to set up a socket bound to the endpoint.

func (*Proxy) SetCapture Uses

func (p *Proxy) SetCapture(endpoint string) error

SetCapture accepts a socket endpoint and sets up a Push socket bound to that endpoint, that sends a copy of all messages passing through the proxy.

func (*Proxy) SetFrontend Uses

func (p *Proxy) SetFrontend(sockType int, endpoint string) error

SetFrontend accepts a socket type and endpoint, and sends a message to the zactor thread telling it to set up a socket bound to the endpoint.

func (*Proxy) Verbose Uses

func (p *Proxy) Verbose() error

Verbose sets the proxy to log information to stdout.

type ReadWriter Uses

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

ReadWriter provides an io.ReadWriter compatible interface for goczmq.Sock

func NewReadWriter Uses

func NewReadWriter(sock *Sock) (*ReadWriter, error)

NewReadWriter accepts a sock and returns a goczmq.ReadWriter. The io.ReadWriter should now be considered responsible for this Sock.

func (*ReadWriter) Destroy Uses

func (r *ReadWriter) Destroy()

Destroy destroys both the ReadWriter and the underlying Sock

func (*ReadWriter) GetLastClientID Uses

func (r *ReadWriter) GetLastClientID() []byte

GetLastClientID returns the id of the last client you received a message from if the underlying socket is a Router socket

func (*ReadWriter) Read Uses

func (r *ReadWriter) Read(p []byte) (int, error)

Read satisifies io.Read

func (*ReadWriter) SetLastClientID Uses

func (r *ReadWriter) SetLastClientID(id []byte)

SetLastClientID lets you manually set the id of the client you last received a message from if the underlying socket is a Router socket

func (*ReadWriter) SetTimeout Uses

func (r *ReadWriter) SetTimeout(ms int)

SetTimeout sets the timeout on Read in millisecond. If no new data is received within the timeout period, Read will return an ErrTimeout

func (*ReadWriter) Write Uses

func (r *ReadWriter) Write(p []byte) (int, error)

Write satisfies io.Write

type Sock Uses

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

Sock wraps the CZMQ zsock class.

Code:

// create dealer socket
dealer, err := NewDealer("inproc://example")
if err != nil {
    panic(err)
}
defer dealer.Destroy()

// create router socket
router, err := NewRouter("inproc://example")
if err != nil {
    panic(err)
}
defer router.Destroy()

// send hello message
err = dealer.SendFrame([]byte("Hello"), FlagNone)
if err != nil {
    panic(err)
}

// receive hello message
request, err := router.RecvMessage()
if err != nil {
    panic(err)
}

// first frame is identify of client - let's append 'World'
// to the message and route it back.
request = append(request, []byte("World"))

// send reply
err = router.SendMessage(request)
if err != nil {
    panic(err)
}

// receive reply
reply, err := dealer.RecvMessage()
if err != nil {
    panic(err)
}

fmt.Printf("%s %s", string(reply[0]), string(reply[1]))

Output:

Hello World

func NewDealer Uses

func NewDealer(endpoints string, options ...SockOption) (*Sock, error)

NewDealer creates a Dealer socket and calls Attach. The socket will Connect by default.

func NewPair Uses

func NewPair(endpoints string, options ...SockOption) (*Sock, error)

NewPair creates a Pair socket and calls Attach. The socket will Connect by default.

func NewPub Uses

func NewPub(endpoints string, options ...SockOption) (*Sock, error)

NewPub creates a Pub socket and calls Attach. The socket will Bind by default.

func NewPull Uses

func NewPull(endpoints string, options ...SockOption) (*Sock, error)

NewPull creates a Pull socket and calls Attach. The socket will Bind by default.

func NewPush Uses

func NewPush(endpoints string, options ...SockOption) (*Sock, error)

NewPush creates a Push socket and calls Attach. The socket will Connect by default.

func NewRep Uses

func NewRep(endpoints string, options ...SockOption) (*Sock, error)

NewRep creates a Rep socket and calls Attach. The socket will Bind by default.

func NewReq Uses

func NewReq(endpoints string, options ...SockOption) (*Sock, error)

NewReq creates a Req socket and calls Attach. The socket will Connect by default.

func NewRouter Uses

func NewRouter(endpoints string, options ...SockOption) (*Sock, error)

NewRouter creates a Router socket and calls Attach. The socket will Bind by default.

func NewSock Uses

func NewSock(t int, options ...SockOption) *Sock

NewSock creates a new socket. The caller source and line number are passed so CZMQ can report socket leaks intelligently.

func NewStream Uses

func NewStream(endpoints string, options ...SockOption) (*Sock, error)

NewStream creates a Stream socket and calls Attach. The socket will Connect by default.

func NewSub Uses

func NewSub(endpoints string, subscribe string, options ...SockOption) (*Sock, error)

NewSub creates a Sub socket and calls Attach. 'subscribe' is a comma delimited list of topics to subscribe to. The socket will Connect by default.

func NewXPub Uses

func NewXPub(endpoints string, options ...SockOption) (*Sock, error)

NewXPub creates an XPub socket and calls Attach. The socket will Bind by default.

func NewXSub Uses

func NewXSub(endpoints string, options ...SockOption) (*Sock, error)

NewXSub creates an XSub socket and calls Attach. The socket will Connect by default.

func (*Sock) Affinity Uses

func (s *Sock) Affinity() int

Affinity returns the current value of the socket's affinity option

func (*Sock) Attach Uses

func (s *Sock) Attach(endpoints string, serverish bool) error

Attach attaches a socket to zero or more endpoints. If endpoints is not null, parses as list of ZeroMQ endpoints, separated by commas, and prefixed by '@' (to bind the socket) or '>' (to attach the socket). If the endpoint does not start with '@' or '>', the serverish argument determines whether it is used to bind (serverish = true) or connect (serverish = false)

func (*Sock) Backlog Uses

func (s *Sock) Backlog() int

Backlog returns the current value of the socket's backlog option

func (*Sock) Bind Uses

func (s *Sock) Bind(endpoint string) (int, error)

Bind binds a socket to an endpoint. On success returns the port number used for tcp transports, or 0 for other transports. On failure returns a -1 for port, and an error.

func (*Sock) Connect Uses

func (s *Sock) Connect(endpoint string) error

Connect connects a socket to an endpoint returns an error if the connect failed.

func (*Sock) ConnectTimeout Uses

func (s *Sock) ConnectTimeout() int

ConnectTimeout returns the current value of the socket's connect_timeout option

func (*Sock) CurvePublickey Uses

func (s *Sock) CurvePublickey() string

CurvePublickey returns the current value of the socket's curve_publickey option

func (*Sock) CurveSecretkey Uses

func (s *Sock) CurveSecretkey() string

CurveSecretkey returns the current value of the socket's curve_secretkey option

func (*Sock) CurveServer Uses

func (s *Sock) CurveServer() int

CurveServer returns the current value of the socket's curve_server option

func (*Sock) CurveServerkey Uses

func (s *Sock) CurveServerkey() string

CurveServerkey returns the current value of the socket's curve_serverkey option

func (*Sock) Destroy Uses

func (s *Sock) Destroy()

Destroy destroys the underlying zsockT.

func (*Sock) Disconnect Uses

func (s *Sock) Disconnect(endpoint string) error

Disconnect disconnects a socket from an endpoint. If returns an error if the endpoint was not found

func (*Sock) Events Uses

func (s *Sock) Events() int

Events returns the current value of the socket's events option

func (*Sock) Fd Uses

func (s *Sock) Fd() int

Fd returns the current value of the socket's fd option

func (*Sock) GetLastClientID Uses

func (s *Sock) GetLastClientID() []byte

GetLastClientID returns the id of the last client you received a message from if the underlying socket is a Router socket DEPRECATED: See goczmq.ReadWriter

func (*Sock) GetType Uses

func (s *Sock) GetType() int

GetType returns the socket's type

func (*Sock) GssapiPlaintext Uses

func (s *Sock) GssapiPlaintext() int

GssapiPlaintext returns the current value of the socket's gssapi_plaintext option

func (*Sock) GssapiPrincipal Uses

func (s *Sock) GssapiPrincipal() string

GssapiPrincipal returns the current value of the socket's gssapi_principal option

func (*Sock) GssapiServer Uses

func (s *Sock) GssapiServer() int

GssapiServer returns the current value of the socket's gssapi_server option

func (*Sock) GssapiServicePrincipal Uses

func (s *Sock) GssapiServicePrincipal() string

GssapiServicePrincipal returns the current value of the socket's gssapi_service_principal option

func (*Sock) HandshakeIvl Uses

func (s *Sock) HandshakeIvl() int

HandshakeIvl returns the current value of the socket's handshake_ivl option

func (*Sock) HeartbeatIvl Uses

func (s *Sock) HeartbeatIvl() int

HeartbeatIvl returns the current value of the socket's heartbeat_ivl option

func (*Sock) HeartbeatTimeout Uses

func (s *Sock) HeartbeatTimeout() int

HeartbeatTimeout returns the current value of the socket's heartbeat_timeout option

func (*Sock) HeartbeatTtl Uses

func (s *Sock) HeartbeatTtl() int

HeartbeatTtl returns the current value of the socket's heartbeat_ttl option

func (*Sock) Identity Uses

func (s *Sock) Identity() string

Identity returns the current value of the socket's identity option

func (*Sock) Immediate Uses

func (s *Sock) Immediate() int

Immediate returns the current value of the socket's immediate option

func (*Sock) InvertMatching Uses

func (s *Sock) InvertMatching() int

InvertMatching returns the current value of the socket's invert_matching option

func (*Sock) Ipv4only Uses

func (s *Sock) Ipv4only() int

Ipv4only returns the current value of the socket's ipv4only option

func (*Sock) Ipv6 Uses

func (s *Sock) Ipv6() int

Ipv6 returns the current value of the socket's ipv6 option

func (*Sock) LastEndpoint Uses

func (s *Sock) LastEndpoint() string

LastEndpoint returns the current value of the socket's last_endpoint option

func (*Sock) Linger Uses

func (s *Sock) Linger() int

Linger returns the current value of the socket's linger option

func (*Sock) Maxmsgsize Uses

func (s *Sock) Maxmsgsize() int

Maxmsgsize returns the current value of the socket's maxmsgsize option

func (*Sock) Mechanism Uses

func (s *Sock) Mechanism() int

Mechanism returns the current value of the socket's mechanism option

func (*Sock) MulticastHops Uses

func (s *Sock) MulticastHops() int

MulticastHops returns the current value of the socket's multicast_hops option

func (*Sock) MulticastMaxtpdu Uses

func (s *Sock) MulticastMaxtpdu() int

MulticastMaxtpdu returns the current value of the socket's multicast_maxtpdu option

func (*Sock) PlainPassword Uses

func (s *Sock) PlainPassword() string

PlainPassword returns the current value of the socket's plain_password option

func (*Sock) PlainServer Uses

func (s *Sock) PlainServer() int

PlainServer returns the current value of the socket's plain_server option

func (*Sock) PlainUsername Uses

func (s *Sock) PlainUsername() string

PlainUsername returns the current value of the socket's plain_username option

func (*Sock) Pollin Uses

func (s *Sock) Pollin() bool

Pollin returns true if there is a Pollin event on the socket

func (*Sock) Pollout Uses

func (s *Sock) Pollout() bool

Pollout returns true if there is a Pollout event on the socket

func (*Sock) Rate Uses

func (s *Sock) Rate() int

Rate returns the current value of the socket's rate option

func (*Sock) Rcvbuf Uses

func (s *Sock) Rcvbuf() int

Rcvbuf returns the current value of the socket's rcvbuf option

func (*Sock) Rcvhwm Uses

func (s *Sock) Rcvhwm() int

Rcvhwm returns the current value of the socket's rcvhwm option

func (*Sock) Rcvmore Uses

func (s *Sock) Rcvmore() int

Rcvmore returns the current value of the socket's rcvmore option

func (*Sock) Rcvtimeo Uses

func (s *Sock) Rcvtimeo() int

Rcvtimeo returns the current value of the socket's rcvtimeo option

func (*Sock) Read Uses

func (s *Sock) Read(p []byte) (int, error)

Read provides an io.Reader interface to a zeromq socket DEPRECATED: see goczmq.ReadWriter

func (*Sock) ReconnectIvl Uses

func (s *Sock) ReconnectIvl() int

ReconnectIvl returns the current value of the socket's reconnect_ivl option

func (*Sock) ReconnectIvlMax Uses

func (s *Sock) ReconnectIvlMax() int

ReconnectIvlMax returns the current value of the socket's reconnect_ivl_max option

func (*Sock) RecoveryIvl Uses

func (s *Sock) RecoveryIvl() int

RecoveryIvl returns the current value of the socket's recovery_ivl option

func (*Sock) RecvFrame Uses

func (s *Sock) RecvFrame() ([]byte, int, error)

RecvFrame reads a frame from the socket and returns it as a byte array, along with a more flag and and error (if there is an error)

func (*Sock) RecvFrameNoWait Uses

func (s *Sock) RecvFrameNoWait() ([]byte, int, error)

RecvFrameNoWait receives a frame from the socket and returns it as a byte array if one is waiting. Returns an empty frame, a 0 more flag and an error if one is not immediately available

func (*Sock) RecvMessage Uses

func (s *Sock) RecvMessage() ([][]byte, error)

RecvMessage receives a full message from the socket and returns it as an array of byte arrays.

func (*Sock) RecvMessageNoWait Uses

func (s *Sock) RecvMessageNoWait() ([][]byte, error)

RecvMessageNoWait receives a full message from the socket and returns it as an array of byte arrays if one is waiting. Returns an empty message and an error if one is not immediately available

func (*Sock) SendFrame Uses

func (s *Sock) SendFrame(data []byte, flags int) error

SendFrame sends a byte array via the socket. For the flags value, use 0 for a single message, or SNDFlagMore if it is a multi-part message

func (*Sock) SendMessage Uses

func (s *Sock) SendMessage(parts [][]byte) error

SendMessage accepts an array of byte arrays and sends it as a multi-part message.

func (*Sock) SetAffinity Uses

func (s *Sock) SetAffinity(val int)

SetAffinity sets the affinity option for the socket

func (*Sock) SetBacklog Uses

func (s *Sock) SetBacklog(val int)

SetBacklog sets the backlog option for the socket

func (*Sock) SetConflate Uses

func (s *Sock) SetConflate(val int)

SetConflate sets the conflate option for the socket

func (*Sock) SetConnectRid Uses

func (s *Sock) SetConnectRid(val string)

SetConnectRid sets the connect_rid option for the socket

func (*Sock) SetConnectTimeout Uses

func (s *Sock) SetConnectTimeout(val int)

SetConnectTimeout sets the connect_timeout option for the socket

func (*Sock) SetCurvePublickey Uses

func (s *Sock) SetCurvePublickey(val string)

SetCurvePublickey sets the curve_publickey option for the socket

func (*Sock) SetCurveSecretkey Uses

func (s *Sock) SetCurveSecretkey(val string)

SetCurveSecretkey sets the curve_secretkey option for the socket

func (*Sock) SetCurveServer Uses

func (s *Sock) SetCurveServer(val int)

SetCurveServer sets the curve_server option for the socket

func (*Sock) SetCurveServerkey Uses

func (s *Sock) SetCurveServerkey(val string)

SetCurveServerkey sets the curve_serverkey option for the socket

func (*Sock) SetDelayAttachOnConnect Uses

func (s *Sock) SetDelayAttachOnConnect(val int)

SetDelayAttachOnConnect sets the delay_attach_on_connect option for the socket

func (*Sock) SetGssapiPlaintext Uses

func (s *Sock) SetGssapiPlaintext(val int)

SetGssapiPlaintext sets the gssapi_plaintext option for the socket

func (*Sock) SetGssapiPrincipal Uses

func (s *Sock) SetGssapiPrincipal(val string)

SetGssapiPrincipal sets the gssapi_principal option for the socket

func (*Sock) SetGssapiServer Uses

func (s *Sock) SetGssapiServer(val int)

SetGssapiServer sets the gssapi_server option for the socket

func (*Sock) SetGssapiServicePrincipal Uses

func (s *Sock) SetGssapiServicePrincipal(val string)

SetGssapiServicePrincipal sets the gssapi_service_principal option for the socket

func (*Sock) SetHandshakeIvl Uses

func (s *Sock) SetHandshakeIvl(val int)

SetHandshakeIvl sets the handshake_ivl option for the socket

func (*Sock) SetHeartbeatIvl Uses

func (s *Sock) SetHeartbeatIvl(val int)

SetHeartbeatIvl sets the heartbeat_ivl option for the socket

func (*Sock) SetHeartbeatTimeout Uses

func (s *Sock) SetHeartbeatTimeout(val int)

SetHeartbeatTimeout sets the heartbeat_timeout option for the socket

func (*Sock) SetHeartbeatTtl Uses

func (s *Sock) SetHeartbeatTtl(val int)

SetHeartbeatTtl sets the heartbeat_ttl option for the socket

func (*Sock) SetIdentity Uses

func (s *Sock) SetIdentity(val string)

SetIdentity sets the identity option for the socket

func (*Sock) SetImmediate Uses

func (s *Sock) SetImmediate(val int)

SetImmediate sets the immediate option for the socket

func (*Sock) SetInvertMatching Uses

func (s *Sock) SetInvertMatching(val int)

SetInvertMatching sets the invert_matching option for the socket

func (*Sock) SetIpv4only Uses

func (s *Sock) SetIpv4only(val int)

SetIpv4only sets the ipv4only option for the socket

func (*Sock) SetIpv6 Uses

func (s *Sock) SetIpv6(val int)

SetIpv6 sets the ipv6 option for the socket

func (*Sock) SetLastClientID Uses

func (s *Sock) SetLastClientID(id []byte)

SetLastClientID lets you manually set the id of the client you last received a message from if the underlying socket is a Router socket DEPRECATED: See goczmq.ReadWriter

func (*Sock) SetLinger Uses

func (s *Sock) SetLinger(val int)

SetLinger sets the linger option for the socket

func (*Sock) SetMaxmsgsize Uses

func (s *Sock) SetMaxmsgsize(val int)

SetMaxmsgsize sets the maxmsgsize option for the socket

func (*Sock) SetMulticastHops Uses

func (s *Sock) SetMulticastHops(val int)

SetMulticastHops sets the multicast_hops option for the socket

func (*Sock) SetMulticastMaxtpdu Uses

func (s *Sock) SetMulticastMaxtpdu(val int)

SetMulticastMaxtpdu sets the multicast_maxtpdu option for the socket

func (*Sock) SetOption Uses

func (s *Sock) SetOption(o SockOption)

SetOption accepts a SockOption and uses it to set an option on the underlying ZeroMQ socket

func (*Sock) SetPlainPassword Uses

func (s *Sock) SetPlainPassword(val string)

SetPlainPassword sets the plain_password option for the socket

func (*Sock) SetPlainServer Uses

func (s *Sock) SetPlainServer(val int)

SetPlainServer sets the plain_server option for the socket

func (*Sock) SetPlainUsername Uses

func (s *Sock) SetPlainUsername(val string)

SetPlainUsername sets the plain_username option for the socket

func (*Sock) SetProbeRouter Uses

func (s *Sock) SetProbeRouter(val int)

SetProbeRouter sets the probe_router option for the socket

func (*Sock) SetRate Uses

func (s *Sock) SetRate(val int)

SetRate sets the rate option for the socket

func (*Sock) SetRcvbuf Uses

func (s *Sock) SetRcvbuf(val int)

SetRcvbuf sets the rcvbuf option for the socket

func (*Sock) SetRcvhwm Uses

func (s *Sock) SetRcvhwm(val int)

SetRcvhwm sets the rcvhwm option for the socket

func (*Sock) SetRcvtimeo Uses

func (s *Sock) SetRcvtimeo(val int)

SetRcvtimeo sets the rcvtimeo option for the socket

func (*Sock) SetReconnectIvl Uses

func (s *Sock) SetReconnectIvl(val int)

SetReconnectIvl sets the reconnect_ivl option for the socket

func (*Sock) SetReconnectIvlMax Uses

func (s *Sock) SetReconnectIvlMax(val int)

SetReconnectIvlMax sets the reconnect_ivl_max option for the socket

func (*Sock) SetRecoveryIvl Uses

func (s *Sock) SetRecoveryIvl(val int)

SetRecoveryIvl sets the recovery_ivl option for the socket

func (*Sock) SetReqCorrelate Uses

func (s *Sock) SetReqCorrelate(val int)

SetReqCorrelate sets the req_correlate option for the socket

func (*Sock) SetReqRelaxed Uses

func (s *Sock) SetReqRelaxed(val int)

SetReqRelaxed sets the req_relaxed option for the socket

func (*Sock) SetRouterHandover Uses

func (s *Sock) SetRouterHandover(val int)

SetRouterHandover sets the router_handover option for the socket

func (*Sock) SetRouterMandatory Uses

func (s *Sock) SetRouterMandatory(val int)

SetRouterMandatory sets the router_mandatory option for the socket

func (*Sock) SetRouterRaw Uses

func (s *Sock) SetRouterRaw(val int)

SetRouterRaw sets the router_raw option for the socket

func (*Sock) SetSndbuf Uses

func (s *Sock) SetSndbuf(val int)

SetSndbuf sets the sndbuf option for the socket

func (*Sock) SetSndhwm Uses

func (s *Sock) SetSndhwm(val int)

SetSndhwm sets the sndhwm option for the socket

func (*Sock) SetSndtimeo Uses

func (s *Sock) SetSndtimeo(val int)

SetSndtimeo sets the sndtimeo option for the socket

func (*Sock) SetSocksProxy Uses

func (s *Sock) SetSocksProxy(val string)

SetSocksProxy sets the socks_proxy option for the socket

func (*Sock) SetStreamNotify Uses

func (s *Sock) SetStreamNotify(val int)

SetStreamNotify sets the stream_notify option for the socket

func (*Sock) SetSubscribe Uses

func (s *Sock) SetSubscribe(val string)

SetSubscribe sets the subscribe option for the socket

func (*Sock) SetTcpAcceptFilter Uses

func (s *Sock) SetTcpAcceptFilter(val string)

SetTcpAcceptFilter sets the tcp_accept_filter option for the socket

func (*Sock) SetTcpKeepalive Uses

func (s *Sock) SetTcpKeepalive(val int)

SetTcpKeepalive sets the tcp_keepalive option for the socket

func (*Sock) SetTcpKeepaliveCnt Uses

func (s *Sock) SetTcpKeepaliveCnt(val int)

SetTcpKeepaliveCnt sets the tcp_keepalive_cnt option for the socket

func (*Sock) SetTcpKeepaliveIdle Uses

func (s *Sock) SetTcpKeepaliveIdle(val int)

SetTcpKeepaliveIdle sets the tcp_keepalive_idle option for the socket

func (*Sock) SetTcpKeepaliveIntvl Uses

func (s *Sock) SetTcpKeepaliveIntvl(val int)

SetTcpKeepaliveIntvl sets the tcp_keepalive_intvl option for the socket

func (*Sock) SetTcpMaxrt Uses

func (s *Sock) SetTcpMaxrt(val int)

SetTcpMaxrt sets the tcp_maxrt option for the socket

func (*Sock) SetTos Uses

func (s *Sock) SetTos(val int)

SetTos sets the tos option for the socket

func (*Sock) SetUnsubscribe Uses

func (s *Sock) SetUnsubscribe(val string)

SetUnsubscribe sets the unsubscribe option for the socket

func (*Sock) SetUseFd Uses

func (s *Sock) SetUseFd(val int)

SetUseFd sets the use_fd option for the socket

func (*Sock) SetVmciBufferMaxSize Uses

func (s *Sock) SetVmciBufferMaxSize(val int)

SetVmciBufferMaxSize sets the vmci_buffer_max_size option for the socket

func (*Sock) SetVmciBufferMinSize Uses

func (s *Sock) SetVmciBufferMinSize(val int)

SetVmciBufferMinSize sets the vmci_buffer_min_size option for the socket

func (*Sock) SetVmciBufferSize Uses

func (s *Sock) SetVmciBufferSize(val int)

SetVmciBufferSize sets the vmci_buffer_size option for the socket

func (*Sock) SetVmciConnectTimeout Uses

func (s *Sock) SetVmciConnectTimeout(val int)

SetVmciConnectTimeout sets the vmci_connect_timeout option for the socket

func (*Sock) SetXPubManual Uses

func (s *Sock) SetXPubManual(val int)

SetXPubManual sets the xpub_manual option for the socket

func (*Sock) SetXPubNodrop Uses

func (s *Sock) SetXPubNodrop(val int)

SetXPubNodrop sets the xpub_nodrop option for the socket

func (*Sock) SetXPubVerbose Uses

func (s *Sock) SetXPubVerbose(val int)

SetXPubVerbose sets the xpub_verbose option for the socket

func (*Sock) SetXPubVerboser Uses

func (s *Sock) SetXPubVerboser(val int)

SetXPubVerboser sets the xpub_verboser option for the socket

func (*Sock) SetXPubWelcomeMsg Uses

func (s *Sock) SetXPubWelcomeMsg(val string)

SetXPubWelcomeMsg sets the xpub_welcome_msg option for the socket

func (*Sock) SetZapDomain Uses

func (s *Sock) SetZapDomain(val string)

SetZapDomain sets the zap_domain option for the socket

func (*Sock) Sndbuf Uses

func (s *Sock) Sndbuf() int

Sndbuf returns the current value of the socket's sndbuf option

func (*Sock) Sndhwm Uses

func (s *Sock) Sndhwm() int

Sndhwm returns the current value of the socket's sndhwm option

func (*Sock) Sndtimeo Uses

func (s *Sock) Sndtimeo() int

Sndtimeo returns the current value of the socket's sndtimeo option

func (*Sock) SocksProxy Uses

func (s *Sock) SocksProxy() string

SocksProxy returns the current value of the socket's socks_proxy option

func (*Sock) TcpAcceptFilter Uses

func (s *Sock) TcpAcceptFilter() string

TcpAcceptFilter returns the current value of the socket's tcp_accept_filter option

func (*Sock) TcpKeepalive Uses

func (s *Sock) TcpKeepalive() int

TcpKeepalive returns the current value of the socket's tcp_keepalive option

func (*Sock) TcpKeepaliveCnt Uses

func (s *Sock) TcpKeepaliveCnt() int

TcpKeepaliveCnt returns the current value of the socket's tcp_keepalive_cnt option

func (*Sock) TcpKeepaliveIdle Uses

func (s *Sock) TcpKeepaliveIdle() int

TcpKeepaliveIdle returns the current value of the socket's tcp_keepalive_idle option

func (*Sock) TcpKeepaliveIntvl Uses

func (s *Sock) TcpKeepaliveIntvl() int

TcpKeepaliveIntvl returns the current value of the socket's tcp_keepalive_intvl option

func (*Sock) TcpMaxrt Uses

func (s *Sock) TcpMaxrt() int

TcpMaxrt returns the current value of the socket's tcp_maxrt option

func (*Sock) ThreadSafe Uses

func (s *Sock) ThreadSafe() int

ThreadSafe returns the current value of the socket's thread_safe option

func (*Sock) Tos Uses

func (s *Sock) Tos() int

Tos returns the current value of the socket's tos option

func (*Sock) Type Uses

func (s *Sock) Type() int

Type returns the current value of the socket's type option

func (*Sock) Unbind Uses

func (s *Sock) Unbind(endpoint string) error

Unbind unbinds a socket from an endpoint. If returns an error if the endpoint was not found

func (*Sock) UseFd Uses

func (s *Sock) UseFd() int

UseFd returns the current value of the socket's use_fd option

func (*Sock) VmciBufferMaxSize Uses

func (s *Sock) VmciBufferMaxSize() int

VmciBufferMaxSize returns the current value of the socket's vmci_buffer_max_size option

func (*Sock) VmciBufferMinSize Uses

func (s *Sock) VmciBufferMinSize() int

VmciBufferMinSize returns the current value of the socket's vmci_buffer_min_size option

func (*Sock) VmciBufferSize Uses

func (s *Sock) VmciBufferSize() int

VmciBufferSize returns the current value of the socket's vmci_buffer_size option

func (*Sock) VmciConnectTimeout Uses

func (s *Sock) VmciConnectTimeout() int

VmciConnectTimeout returns the current value of the socket's vmci_connect_timeout option

func (*Sock) Write Uses

func (s *Sock) Write(p []byte) (int, error)

Write provides an io.Writer interface to a zeromq socket DEPRECATED: See goczmq.ReadWriter

func (*Sock) ZapDomain Uses

func (s *Sock) ZapDomain() string

ZapDomain returns the current value of the socket's zap_domain option

type SockOption Uses

type SockOption func(*Sock)

SockOption is a type for setting options on the underlying ZeroMQ socket

func SockSetAffinity Uses

func SockSetAffinity(v int) SockOption

SockSetAffinity sets the affinity option for the socket

func SockSetBacklog Uses

func SockSetBacklog(v int) SockOption

SockSetBacklog sets the backlog option for the socket

func SockSetConflate Uses

func SockSetConflate(v int) SockOption

SockSetConflate sets the conflate option for the socket

func SockSetConnectRid Uses

func SockSetConnectRid(v string) SockOption

SockSetConnectRid sets the connect_rid option for the socket

func SockSetConnectTimeout Uses

func SockSetConnectTimeout(v int) SockOption

SockSetConnectTimeout sets the connect_timeout option for the socket

func SockSetCurvePublickey Uses

func SockSetCurvePublickey(v string) SockOption

SockSetCurvePublickey sets the curve_publickey option for the socket

func SockSetCurveSecretkey Uses

func SockSetCurveSecretkey(v string) SockOption

SockSetCurveSecretkey sets the curve_secretkey option for the socket

func SockSetCurveServer Uses

func SockSetCurveServer(v int) SockOption

SockSetCurveServer sets the curve_server option for the socket

func SockSetCurveServerkey Uses

func SockSetCurveServerkey(v string) SockOption

SockSetCurveServerkey sets the curve_serverkey option for the socket

func SockSetDelayAttachOnConnect Uses

func SockSetDelayAttachOnConnect(v int) SockOption

SockSetDelayAttachOnConnect sets the delay_attach_on_connect option for the socket

func SockSetGssapiPlaintext Uses

func SockSetGssapiPlaintext(v int) SockOption

SockSetGssapiPlaintext sets the gssapi_plaintext option for the socket

func SockSetGssapiPrincipal Uses

func SockSetGssapiPrincipal(v string) SockOption

SockSetGssapiPrincipal sets the gssapi_principal option for the socket

func SockSetGssapiServer Uses

func SockSetGssapiServer(v int) SockOption

SockSetGssapiServer sets the gssapi_server option for the socket

func SockSetGssapiServicePrincipal Uses

func SockSetGssapiServicePrincipal(v string) SockOption

SockSetGssapiServicePrincipal sets the gssapi_service_principal option for the socket

func SockSetHandshakeIvl Uses

func SockSetHandshakeIvl(v int) SockOption

SockSetHandshakeIvl sets the handshake_ivl option for the socket

func SockSetHeartbeatIvl Uses

func SockSetHeartbeatIvl(v int) SockOption

SockSetHeartbeatIvl sets the heartbeat_ivl option for the socket

func SockSetHeartbeatTimeout Uses

func SockSetHeartbeatTimeout(v int) SockOption

SockSetHeartbeatTimeout sets the heartbeat_timeout option for the socket

func SockSetHeartbeatTtl Uses

func SockSetHeartbeatTtl(v int) SockOption

SockSetHeartbeatTtl sets the heartbeat_ttl option for the socket

func SockSetIdentity Uses

func SockSetIdentity(v string) SockOption

SockSetIdentity sets the identity option for the socket

func SockSetImmediate Uses

func SockSetImmediate(v int) SockOption

SockSetImmediate sets the immediate option for the socket

func SockSetInvertMatching Uses

func SockSetInvertMatching(v int) SockOption

SockSetInvertMatching sets the invert_matching option for the socket

func SockSetIpv4only Uses

func SockSetIpv4only(v int) SockOption

SockSetIpv4only sets the ipv4only option for the socket

func SockSetIpv6 Uses

func SockSetIpv6(v int) SockOption

SockSetIpv6 sets the ipv6 option for the socket

func SockSetLinger Uses

func SockSetLinger(v int) SockOption

SockSetLinger sets the linger option for the socket

func SockSetMaxmsgsize Uses

func SockSetMaxmsgsize(v int) SockOption

SockSetMaxmsgsize sets the maxmsgsize option for the socket

func SockSetMulticastHops Uses

func SockSetMulticastHops(v int) SockOption

SockSetMulticastHops sets the multicast_hops option for the socket

func SockSetMulticastMaxtpdu Uses

func SockSetMulticastMaxtpdu(v int) SockOption

SockSetMulticastMaxtpdu sets the multicast_maxtpdu option for the socket

func SockSetPlainPassword Uses

func SockSetPlainPassword(v string) SockOption

SockSetPlainPassword sets the plain_password option for the socket

func SockSetPlainServer Uses

func SockSetPlainServer(v int) SockOption

SockSetPlainServer sets the plain_server option for the socket

func SockSetPlainUsername Uses

func SockSetPlainUsername(v string) SockOption

SockSetPlainUsername sets the plain_username option for the socket

func SockSetProbeRouter Uses

func SockSetProbeRouter(v int) SockOption

SockSetProbeRouter sets the probe_router option for the socket

func SockSetRate Uses

func SockSetRate(v int) SockOption

SockSetRate sets the rate option for the socket

func SockSetRcvbuf Uses

func SockSetRcvbuf(v int) SockOption

SockSetRcvbuf sets the rcvbuf option for the socket

func SockSetRcvhwm Uses

func SockSetRcvhwm(v int) SockOption

SockSetRcvhwm sets the rcvhwm option for the socket

func SockSetRcvtimeo Uses

func SockSetRcvtimeo(v int) SockOption

SockSetRcvtimeo sets the rcvtimeo option for the socket

func SockSetReconnectIvl Uses

func SockSetReconnectIvl(v int) SockOption

SockSetReconnectIvl sets the reconnect_ivl option for the socket

func SockSetReconnectIvlMax Uses

func SockSetReconnectIvlMax(v int) SockOption

SockSetReconnectIvlMax sets the reconnect_ivl_max option for the socket

func SockSetRecoveryIvl Uses

func SockSetRecoveryIvl(v int) SockOption

SockSetRecoveryIvl sets the recovery_ivl option for the socket

func SockSetReqCorrelate Uses

func SockSetReqCorrelate(v int) SockOption

SockSetReqCorrelate sets the req_correlate option for the socket

func SockSetReqRelaxed Uses

func SockSetReqRelaxed(v int) SockOption

SockSetReqRelaxed sets the req_relaxed option for the socket

func SockSetRouterHandover Uses

func SockSetRouterHandover(v int) SockOption

SockSetRouterHandover sets the router_handover option for the socket

func SockSetRouterMandatory Uses

func SockSetRouterMandatory(v int) SockOption

SockSetRouterMandatory sets the router_mandatory option for the socket

func SockSetRouterRaw Uses

func SockSetRouterRaw(v int) SockOption

SockSetRouterRaw sets the router_raw option for the socket

func SockSetSndbuf Uses

func SockSetSndbuf(v int) SockOption

SockSetSndbuf sets the sndbuf option for the socket

func SockSetSndhwm Uses

func SockSetSndhwm(v int) SockOption

SockSetSndhwm sets the sndhwm option for the socket

func SockSetSndtimeo Uses

func SockSetSndtimeo(v int) SockOption

SockSetSndtimeo sets the sndtimeo option for the socket

func SockSetSocksProxy Uses

func SockSetSocksProxy(v string) SockOption

SockSetSocksProxy sets the socks_proxy option for the socket

func SockSetStreamNotify Uses

func SockSetStreamNotify(v int) SockOption

SockSetStreamNotify sets the stream_notify option for the socket

func SockSetSubscribe Uses

func SockSetSubscribe(v string) SockOption

SockSetSubscribe sets the subscribe option for the socket

func SockSetTcpAcceptFilter Uses

func SockSetTcpAcceptFilter(v string) SockOption

SockSetTcpAcceptFilter sets the tcp_accept_filter option for the socket

func SockSetTcpKeepalive Uses

func SockSetTcpKeepalive(v int) SockOption

SockSetTcpKeepalive sets the tcp_keepalive option for the socket

func SockSetTcpKeepaliveCnt Uses

func SockSetTcpKeepaliveCnt(v int) SockOption

SockSetTcpKeepaliveCnt sets the tcp_keepalive_cnt option for the socket

func SockSetTcpKeepaliveIdle Uses

func SockSetTcpKeepaliveIdle(v int) SockOption

SockSetTcpKeepaliveIdle sets the tcp_keepalive_idle option for the socket

func SockSetTcpKeepaliveIntvl Uses

func SockSetTcpKeepaliveIntvl(v int) SockOption

SockSetTcpKeepaliveIntvl sets the tcp_keepalive_intvl option for the socket

func SockSetTcpMaxrt Uses

func SockSetTcpMaxrt(v int) SockOption

SockSetTcpMaxrt sets the tcp_maxrt option for the socket

func SockSetTos Uses

func SockSetTos(v int) SockOption

SockSetTos sets the tos option for the socket

func SockSetUnsubscribe Uses

func SockSetUnsubscribe(v string) SockOption

SockSetUnsubscribe sets the unsubscribe option for the socket

func SockSetUseFd Uses

func SockSetUseFd(v int) SockOption

SockSetUseFd sets the use_fd option for the socket

func SockSetVmciBufferMaxSize Uses

func SockSetVmciBufferMaxSize(v int) SockOption

SockSetVmciBufferMaxSize sets the vmci_buffer_max_size option for the socket

func SockSetVmciBufferMinSize Uses

func SockSetVmciBufferMinSize(v int) SockOption

SockSetVmciBufferMinSize sets the vmci_buffer_min_size option for the socket

func SockSetVmciBufferSize Uses

func SockSetVmciBufferSize(v int) SockOption

SockSetVmciBufferSize sets the vmci_buffer_size option for the socket

func SockSetVmciConnectTimeout Uses

func SockSetVmciConnectTimeout(v int) SockOption

SockSetVmciConnectTimeout sets the vmci_connect_timeout option for the socket

func SockSetXPubManual Uses

func SockSetXPubManual(v int) SockOption

SockSetXPubManual sets the xpub_manual option for the socket

func SockSetXPubNodrop Uses

func SockSetXPubNodrop(v int) SockOption

SockSetXPubNodrop sets the xpub_nodrop option for the socket

func SockSetXPubVerbose Uses

func SockSetXPubVerbose(v int) SockOption

SockSetXPubVerbose sets the xpub_verbose option for the socket

func SockSetXPubVerboser Uses

func SockSetXPubVerboser(v int) SockOption

SockSetXPubVerboser sets the xpub_verboser option for the socket

func SockSetXPubWelcomeMsg Uses

func SockSetXPubWelcomeMsg(v string) SockOption

SockSetXPubWelcomeMsg sets the xpub_welcome_msg option for the socket

func SockSetZapDomain Uses

func SockSetZapDomain(v string) SockOption

SockSetZapDomain sets the zap_domain option for the socket

Package goczmq imports 10 packages (graph) and is imported by 6 packages. Updated 2019-03-01. Refresh now. Tools for package owners.