Module: NATSD

Defined in:
lib/nats/server/varz.rb,
lib/nats/server/connz.rb,
lib/nats/server/const.rb,
lib/nats/server/route.rb,
lib/nats/server/server.rb,
lib/nats/server/cluster.rb,
lib/nats/server/options.rb,
lib/nats/server/connection.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: Connection Classes: Connz, Route, Server, Subscriber, Varz

Constant Summary collapse

VERSION =
'0.5.1'
APP_NAME =
'nats-server'
DEFAULT_PORT =
4222
DEFAULT_HOST =
'0.0.0.0'
AWAITING_CONTROL_LINE =

Parser

1
AWAITING_MSG_PAYLOAD =
2
INFO =

Ops - See protocol.txt for more info

/\AINFO\s*([^\r\n]*)\r\n/i
PUB_OP =
/\APUB\s+([^\s]+)\s+(([^\s]+)[^\S\r\n]+)?(\d+)\r\n/i
MSG =
/\AMSG\s+([^\s]+)\s+([^\s]+)\s+(([^\s]+)[^\S\r\n]+)?(\d+)\r\n/i
SUB_OP =
/\ASUB\s+([^\s]+)\s+(([^\s]+)[^\S\r\n]+)?([^\s]+)\r\n/i
UNSUB_OP =
/\AUNSUB\s+([^\s]+)\s*(\s+(\d+))?\r\n/i
PING =
/\APING\s*\r\n/i
PONG =
/\APONG\s*\r\n/i
INFO_REQ =
/\AINFO_REQ\s*\r\n/i
CONNECT =
/\ACONNECT\s+([^\r\n]+)\r\n/i
UNKNOWN =
/\A(.*)\r\n/
CTRL_C =
/\006/
CTRL_D =
/\004/
ERR_RESP =
/\A-ERR\s+('.+')?\r\n/i
OK_RESP =

:nodoc:

/\A\+OK\s*\r\n/i
CR_LF =

RESPONSES

"\r\n".freeze
CR_LF_SIZE =
CR_LF.bytesize
EMPTY =
''.freeze
OK =
"+OK#{CR_LF}".freeze
PING_RESPONSE =
"PING#{CR_LF}".freeze
PONG_RESPONSE =
"PONG#{CR_LF}".freeze
INFO_RESPONSE =
"#{CR_LF}".freeze
PAYLOAD_TOO_BIG =

ERR responses

"-ERR 'Payload size exceeded'#{CR_LF}".freeze
PROTOCOL_OP_TOO_BIG =
"-ERR 'Protocol Operation size exceeded'#{CR_LF}".freeze
INVALID_SUBJECT =
"-ERR 'Invalid Subject'#{CR_LF}".freeze
INVALID_SID_TAKEN =
"-ERR 'Invalid Subject Identifier (sid), already taken'#{CR_LF}".freeze
INVALID_SID_NOEXIST =
"-ERR 'Invalid Subject-Identifier (sid), no subscriber registered'#{CR_LF}".freeze
INVALID_CONFIG =
"-ERR 'Invalid config, valid JSON required for connection configuration'#{CR_LF}".freeze
AUTH_REQUIRED =
"-ERR 'Authorization is required'#{CR_LF}".freeze
AUTH_FAILED =
"-ERR 'Authorization failed'#{CR_LF}".freeze
SSL_REQUIRED =
"-ERR 'TSL/SSL is required'#{CR_LF}".freeze
SSL_FAILED =
"-ERR 'TLS/SSL failed'#{CR_LF}".freeze
UNKNOWN_OP =
"-ERR 'Unknown Protocol Operation'#{CR_LF}".freeze
SLOW_CONSUMER =
"-ERR 'Slow consumer detected, connection dropped'#{CR_LF}".freeze
UNRESPONSIVE =
"-ERR 'Unresponsive client detected, connection dropped'#{CR_LF}".freeze
MAX_CONNS_EXCEEDED =
"-ERR 'Maximum client connections exceeded, connection dropped'#{CR_LF}".freeze
SUB =

Pedantic Mode

/^([^\.\*>\s]+|>$|\*)(\.([^\.\*>\s]+|>$|\*))*$/
SUB_NO_WC =
/^([^\.\*>\s]+)(\.([^\.\*>\s]+))*$/
RSID =

Router Subscription Identifiers

/RSID:(\d+):(\S+)/
MAX_CONTROL_LINE_SIZE =

1k should be plenty since payloads sans connect string are separate

1024
MAX_PAYLOAD_SIZE =

Should be using something different if > 1MB payload

(1024*1024)
MAX_PENDING_SIZE =

Maximum outbound size per client

(10*1024*1024)
MAX_WRITEV_SIZE =

Maximum pending bucket size

(64*1024)
DEFAULT_MAX_CONNECTIONS =

Maximum connections default

(64*1024)
SSL_TIMEOUT =

TLS/SSL wait time

0.5
AUTH_TIMEOUT =

Authorization wait time

SSL_TIMEOUT + 0.5
DEFAULT_PING_INTERVAL =

Ping intervals

120
DEFAULT_PING_MAX =
2
DEFAULT_ROUTE_RECONNECT_INTERVAL =

Route Reconnect

1.0
RACK_JSON_HDR =

HTTP

{ 'Content-Type' => 'application/json' }
RACK_TEXT_HDR =
{ 'Content-Type' => 'text/plain' }