Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ PacketHandlers: 1024, PacketBuffer: 50, DownlinkPathExpires: 90 * time.Second, ConnectionExpires: 3 * time.Minute, ConnectionErrorExpires: 5 * time.Minute, ScheduleLateTime: 800 * time.Millisecond, AddrChangeBlock: 0, RateLimiting: RateLimitingConfig{ Enable: true, Messages: 10, Threshold: 10 * time.Millisecond, }, }
DefaultConfig contains the default configuration. We assume that the gateway sends a PULL_DATA message every 30 seconds, instead of the default of 5 seconds. This behavior has been observed in the wild, and is often used by gateways which use metered connections.
Functions ¶
Types ¶
type Config ¶
type Config struct { // PacketHandlers defines the number of concurrent packet handlers. PacketHandlers int `name:"packet-handlers" description:"Number of concurrent packet handlers"` // PacketBuffer defines how many packets are buffered to handlers before it overflows. PacketBuffer int `name:"packet-buffer" description:"Buffer size of unhandled packets"` // DownlinkPathExpires defines for how long a downlink path is valid. A downlink path is renewed on each pull data and // Tx acknowledgment packet. // Gateways typically pull data every 5 seconds. DownlinkPathExpires time.Duration `name:"downlink-path-expires" description:"Time after which a downlink path to a gateway expires"` // ConnectionExpires defines for how long a connection remains valid while no pull data, push data or Tx // acknowledgment is received. ConnectionExpires time.Duration `name:"connection-expires" description:"Time after which a connection of a gateway expires"` // ConnectionErrorExpires defines for how long an existing connection is cached by the Gateway Server when there is a connection error // before initiating a new connection. This ensures that packet handlers are not being stalled by gateways which cannot connect but // still attempt to do so. ConnectionErrorExpires time.Duration `name:"connection-error-expires" description:"Time after which a connection error of a gateway expires"` // ScheduleLateTime defines the time in advance to the actual transmission the downlink message should be scheduled to // the gateway. ScheduleLateTime time.Duration `name:"schedule-late-time" description:"Time in advance to send downlink to the gateway when scheduling late"` // AddrChangeBlock defines the time to block traffic when the address changes. AddrChangeBlock time.Duration `name:"addr-change-block" description:"Time to block traffic when a gateway's address changes"` // RateLimitingConfig is the configuration for the rate limiting firewall capabilities. RateLimiting RateLimitingConfig `name:"rate-limiting"` }
Config contains configuration settings for the UDP gateway frontend. Use DefaultConfig for recommended settings.
type Firewall ¶
Firewall filters packets by tracking addresses and time.
func NewMemoryFirewall ¶
NewMemoryFirewall returns an in-memory Firewall.
type RateLimitingConfig ¶
type RateLimitingConfig struct { Enable bool `name:"enable" description:"Enable rate limiting for gateways"` Messages int `name:"messages" description:"Number of past messages to check timestamp for"` Threshold time.Duration `` //nolint:lll /* 139-byte string literal not displayed */ }
RateLimitingConfig contains configuration settings for the rate limiting capabilities of the UDP gateway frontend firewall.
Click to show internal directories.
Click to hide internal directories.