Skip to content

Commit bce441f

Browse files
committed
no forward
1 parent 1c08fc7 commit bce441f

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Variable | Default | Description
1919
`LOG_COLORIZED` | `0` | Log using colors (`0`=disabled, `1`=enabled).
2020
`LOG_FMT` | `%y%m%d %H:%M:%S` | Log format prefix.
2121
`LISTEN_PORT` | `2055` | Port to listen to for flow packets
22-
`FORWARD_HOST` | `127.0.0.1` | Forward UDP traffic to this host (only applicable if FORWARD_PORTS is set).
23-
`FORWARD_PORTS` | _none_ | Forward UDP traffic to these local ports for other listeners (comma separate for multiple ports).
2422

2523
## Docker build
2624

lib/server.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
from .state import subscriptions
99

1010
LISTEN_PORT = int(os.getenv('LISTEN_PORT', '2055'))
11-
FORWARD_HOST = os.getenv('FORWARD_HOST', '127.0.0.1')
12-
FORWARD_PORTS = os.getenv('FORWARD_PORTS')
13-
FORWARD = [
14-
(FORWARD_HOST, pt)
15-
for pt in map(int, FORWARD_PORTS.split(','))
16-
] if FORWARD_PORTS else []
17-
assert all(0 < pt < 65536 and pt != LISTEN_PORT for _, pt in FORWARD)
18-
assert len(FORWARD) == len(set(FORWARD))
1911

2012
COMMON_HEADER_FMT = '>HHL'
2113
COMMON_HEADER_SZ = 8
@@ -26,7 +18,6 @@ class ServerProtocol(asyncio.Protocol):
2618
def __init__(self):
2719
super().__init__()
2820
self.log_unsupported_version = 0
29-
self.log_failed_to_forward = set()
3021

3122
def connection_made(self, transport):
3223
self.transport = transport
@@ -47,14 +38,6 @@ def datagram_received(self, data, addr):
4738
logging.warning('unsupported netflow version')
4839
return
4940

50-
for dest in FORWARD:
51-
try:
52-
self.transport.sendto(data, dest)
53-
except Exception:
54-
if dest not in self.log_failed_to_forward:
55-
self.log_failed_to_forward.add(dest)
56-
logging.warning(f'failed to forward package to {dest}')
57-
5841
# v5 has no templates so could be ignored when no checks are listening
5942
if version == 5 and not subscriptions:
6043
return

0 commit comments

Comments
 (0)