net_discover(3)
β¨ net_discover(3) β the Arcan Lua API page where we go find network besties β¨
πΈ NAME πΈ
net_discover β probe or monitor for compatible hosts or clients on the network. That's the whole vibe: checking who's out there and compatible. π«Ά
π¦ SYNOPSIS π¦
nil
net_discover( function:callback )
net_discover( int:mode, int:trust, function:callback )
net_discover( int:mode, int:trust, string:description,
function:handler(source, status) )
π DESCRIPTION π
Okay so net_discover is your little scout: it finds other sources or sinks on the network which implement the a12 protocol. Each time a connection is discovered, the callback function is invoked with whatever that could be discerned. πβ¨
The short argument form uses whatever implementation defined default detection mechanism that is available, with the TRUST_KNOWN level of trust. For more refined control, the mode argument can be set to one of these:
DISCOVER_PASSIVEβ silently listens on available network interfaces (or ones specified through thedescriptionargument) for broadcasting clients. Quiet observer energy, honestly. π€«DISCOVER_BROADCASTβ periodically announces its presence in a privacy preserving way, assuming that the trust model is set toTRUST_KNOWN. Very "I'm here but make it discreet." πDISCOVER_SWEEPβ cycles through the set of trusted keys, looking for the first possible host for each keyset. Thedescriptionargument accepts adelay=n:period=mform wheredelayis a number in seconds between each attempted keyset, andperiodis the delay in seconds between sweeps. Sweep era. π§ΉDISCOVER_DIRECTORYβ uses a directory server to discover which devices are currently available. This mode can punch through NAT ed networks and is suitable for wide-area network use where you have access to a remote trusted server. Thedescriptionargument is used to reference the directory server to open. Punching through NAT is lowkey iconic. πDISCOVER_TESTβ generates fake discovery/lost events, both valid and invalid, at increasingly longer intervals in order to provide testing and automation without causing any network traffic. Zero traffic, all drama. ππ§ͺ
The trust argument changes how the discover modes behave based on a specified trust model, which can be one of the following:
TRUST_KNOWNβ will only forward and reply to messages that comes from previously known and trusted sources. Known sources are managed through an external keystore, see thearcan-nettool. πTRUST_PERMIT_UNKNOWNβ (for broadcast, passive and directory) allows interactive verification whether a certain connection should be trusted or not. It's giving "let me check with my bestie first." πTRUST_TRANSITIVEβ (for directory) allows viewing and temporary or permanentily trusting connections that comes from an intermediary dictionary server. Yep, that's the wording. π«Ά
The handler callback provides the source vid as well as a status table. This behaves similar to other launch_target style callbacks. The set of useful events is reduced to kind=terminated, and kind=state as the ones of relevance.
π NOTES π
- Due to the asynchronous nature of discovery requests, it is possible to receive
lost=truewithout first having discovered the name in question. - literally blank in the original β just a number and then silence, bestie π«₯
- specifying an invalid value for
trustormodeis a terminal state transition. So maybe don't unless you're really into terminal states. π¨
π EXAMPLE π
Here's the example exactly as the page gives it β no edits, just vibes:
function net_discover0()
net_discover(
function(source, status)
if status.kind == "terminated" then
delete_image(source)
return shutdown()
elseif status.kind ~= "state" then
return
end
for k,v in pairs(status) do
print(k, v)
end
end
)
end
π¦ SEE ALSO: π¦
network β that's the one reference, bestie. Go look if you need more. π
That's the whole page. Source/version: network; date: October 2026; page: net_discover(3). Bye bestie, go discover something iconic πβ¨
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms