A powerful network utility tool written in Go, supporting TCP/UDP/Unix socket communication with server, client, and proxy modes.
- Multiple Modes: Server, Client, and Proxy modes
- Protocol Support: TCP, UDP, and Unix domain sockets
- Connection Retry: Configurable retry count with infinite retry support
- Connection Timeout: Configurable timeout for connections
- Output File: Save received data to a file
- Latency Monitoring: Real-time latency display option
- Graceful Shutdown: Clean shutdown on SIGINT/SIGTERM signals
- Thread-Safe: Concurrent-safe file writing with sync writer
- Error Handling: Comprehensive error handling and logging
yay -S neter
# or
paru -S netergit clone https://github.com/ischenyu/neter.git
cd neter
go build -o neter .go install github.com/ischenyu/neter@latestneter [flags]| Flag | Description | Default |
|---|---|---|
-m |
Mode: server, client, proxy | client |
-t |
Protocol: tcp, udp, unix | tcp |
-h |
Host (or path for unix socket) | - |
-p |
Port | - |
-o |
Output file path | - |
-r |
Retry count (0=no retry, -1=infinite) | 0 |
-T |
Connection timeout | 5s |
-proxy |
Proxy destination (host:port), proxy mode only | - |
-latency |
Show latency to stdout | false |
Start a TCP server on port 8080:
neter -m server -h 0.0.0.0 -p 8080Start a UDP server:
neter -m server -t udp -h 0.0.0.0 -p 8080Start a Unix socket server:
neter -m server -t unix -h /tmp/neter.sockConnect to a TCP server:
neter -m client -h 127.0.0.1 -p 8080Connect with retry (infinite):
neter -m client -h 127.0.0.1 -p 8080 -r -1Connect with timeout and retry:
neter -m client -h 127.0.0.1 -p 8080 -r 5 -T 10sSave output to file:
neter -m client -h 127.0.0.1 -p 8080 -o output.logShow latency:
neter -m client -h 127.0.0.1 -p 8080 -latencyStart a proxy listening on port 9090 and forwarding to 127.0.0.1:8080:
neter -m proxy -h 0.0.0.0 -p 9090 -proxy 127.0.0.1:8080- Go 1.26 or later
# Clone the repository
git clone https://github.com/ischenyu/neter.git
cd neter
# Build
go build -o neter .
# Run tests
go test -v -race ./...
# Build with optimizations
go build -ldflags="-s -w" -o neter .- TCP: Standard stream-based connections with proper half-close support
- UDP: Connectionless datagram handling with per-client tracking
- Unix: Domain socket support for local IPC
Client/Server → handleConnection() → stdout + optional file output
↑
stdin → network
Client → Proxy Listener → Target Server
↓ ↑
localConn ←→ remoteConn (bidirectional forwarding)
All close operations are properly handled with error logging:
- Listener close errors
- Connection close errors
- File write errors
- Read/Write operation errors
Run the test suite:
# Run all tests
go test -v ./...
# Run with race detection
go test -v -race ./...
# Run specific test
go test -v -run TestTCP ./...- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Go's standard library
- Inspired by netcat and similar tools