mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Expand Broker APIs to allow tracking directionality of peering establishment
This provides ways to figure out for a given peer, or a given address/port pair, whether the local node originally established the peering.
This commit is contained in:
parent
d59f6014b8
commit
b430d5235c
9 changed files with 123 additions and 1 deletions
|
@ -264,6 +264,10 @@ export {
|
|||
type PeerInfo: record {
|
||||
peer: EndpointInfo;
|
||||
status: PeerStatus;
|
||||
|
||||
## Whether the local node created the peering, as opposed to a
|
||||
## remote establishing it by connecting to us.
|
||||
is_outbound: bool;
|
||||
};
|
||||
|
||||
type PeerInfos: vector of PeerInfo;
|
||||
|
@ -367,6 +371,16 @@ export {
|
|||
## TODO: We do not have a function yet to terminate a connection.
|
||||
global unpeer: function(a: string, p: port): bool;
|
||||
|
||||
## Whether the local node originally initiated the peering with the
|
||||
## given endpoint.
|
||||
##
|
||||
## a: the address used in previous successful call to :zeek:see:`Broker::peer`.
|
||||
##
|
||||
## p: the port used in previous successful call to :zeek:see:`Broker::peer`.
|
||||
##
|
||||
## Returns:: True if this node initiated the peering.
|
||||
global is_outbound_peering: function(a: string, p: port): bool;
|
||||
|
||||
## Get a list of all peer connections.
|
||||
##
|
||||
## Returns: a list of all peer connections.
|
||||
|
@ -522,6 +536,11 @@ function unpeer(a: string, p: port): bool
|
|||
return __unpeer(a, p);
|
||||
}
|
||||
|
||||
function is_outbound_peering(a: string, p: port): bool
|
||||
{
|
||||
return __is_outbound_peering(a, p);
|
||||
}
|
||||
|
||||
function peers(): vector of PeerInfo
|
||||
{
|
||||
return __peers();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue