dnsjit.filter.ipsplit(3)

πŸ“¦
version 1.5.1 Β· 5 versions
, in epel 10, epel 9, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– dnsjit.filter.ipsplit β€” from the dnsjit manual, section 3 πŸ’–

okay bestie, gather round, because this one is literally so satisfying once it clicks. it's dnsjit.filter.ipsplit, and it's the little filter that sorts your packets by who sent them. let's get into it 🫢


✨ NAME ✨

dnsjit.filter.ipsplit β€” pass objects to receivers based on the source IP address πŸŽ€


🌸 SYNOPSIS 🌸

local ipsplit = require("dnsjit.filter.ipsplit").new()
ipsplit.receiver(...)
ipsplit.receiver(...)
ipsplit.receiver(...)
input.receiver(ipsplit)

look at that. three receivers, one filter, zero drama. the way that just works πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the filter passes objects on to other receivers. that's its whole job and it does it gorgeously.

any object chain that doesn't have an IPv4/IPv6 packet in it? discarded. bye πŸ‘‹ not invited.

packets that share the same source IP address are considered to be sent from the same "client". that's the whole mental model, bestie β€” source IP = client identity, periodt.

when the first packet from a client gets processed, that client gets assigned to a receiver. and then? every single object from that client goes to the assigned receiver. forever (well, for the lifetime of the filter, but you get the vibe). no flip-flopping, no chaos. main character consistency πŸ’–

oh and bonus feature: the filter can also write a receiver-specific client ID (starting from 1) into the source or destination IP in the packet. cute, right?


🧚 Functions 🧚

  • IpSplit.new() β€” creates a brand new IpSplit filter. fresh out the box, ready to slay ✨
  • IpSplit:log() β€” hands you the Log object so you can control logging for this instance or module. useful when you're like "wait why is stuff disappearing" 😭
  • IpSplit:receive() β€” returns the C functions and context for receiving objects. that's the plumbing, don't touch it, just trust it 🫢
  • IpSplit:receiver(o, weight) β€” set the receiver that objects get passed to. call it multiple times to add more receivers, stack 'em up πŸ’…
    • the weight parameter adjusts how clients get distributed among receivers.
    • weight must be a positive integer.
    • default is 1.
  • IpSplit:discarded() β€” the number of input packets that got discarded for various reasons. ngl if this number is big, something's up. to investigate causes, run with an increased logging level πŸ”
  • IpSplit:sequential() β€” sets the client assignment mode to sequential. it assigns weight clients to a receiver before moving on to the next receiver. this is the default mode, bestie. it's giving orderly. it's giving line leader energy πŸ‘‘
  • IpSplit:random(seed) β€” sets the client assignment mode to random. each client gets randomly assigned to a receiver, and weight affects the probability. the important part: the client assignment is stable (and portable) for a given seed. so same seed, same split, every time. reproducibility ate and left no crumbs πŸ“
  • IpSplit:overwrite_none() β€” don't overwrite the source or destination IP. this is the default πŸŽ€
  • IpSplit:overwrite_src() β€” write the receiver-specific client ID into bytes 0-3 of the source IP (host byte order). noted. exact. don't forget the byte order, iykyk πŸ’œ
  • IpSplit:overwrite_dst() β€” write the receiver-specific client ID into bytes 0-3 of the destination IP (host byte order). same deal, different field 🌈

πŸ‘‘ AUTHORS and CONTRIBUTORS πŸ‘‘

these absolute legends made it happen:

  • Jerry LundstrΓΆm (DNS-OARC)
  • TomΓ‘Ε‘ KΕ™Γ­ΕΎek (CZ.NIC)
  • Petr Ε paček (ISC)

maintained by DNS-OARC πŸ’–

https://www.dns-oarc.net/

πŸ’€ BUGS πŸ’€

found a bug? want a feature? pls don't suffer in silence, go here:

https://codeberg.org/DNS-OARC/dnsjit/issues

got a question or just need a hand? hit up:

admin@dns-oarc.net

fr fr, if something's acting cursed, the issue tracker is the move. they're nice, i promise 🫢

and that's the whole page, bestie!! this was dnsjit.filter.ipsplit(3) from dnsjit version 1.5.1 β€” go split those clients, stay stable with your seed, and don't forget to check discarded() when things get weird. mwah πŸ’…βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’–