How ehang-io/nps works
NPS is an intranet-penetration proxy with a server, connecting NPC clients, and a web management interface. The main workflow is: an operator configures a client and tunnel or host rule in the web UI; the server starts the corresponding proxy; the NPC client maintains a bridge connection and carries traffic between the server and a local target. The README also documents multiple proxy protocols, HTTPS/domain routing, monitoring, and optional transport features. Some subsystem links are based on documented capabilities because their implementation was not sampled.
Main entry points: server.go NPS server · bridge.go Client bridge · client.go NPC client · router.go Web UI/API
Components 20
Management
- Web UI/API
web/routers/router.go - Login and auth
web/controllers/auth.go - Client management
web/controllers/client.go - Tunnel and host rules
web/controllers/index.go - Dashboard
web/controllers/index.go
Client Control
- NPC client
client/client.go - Client configuration
client/local.go - Client bridge
bridge/bridge.go - NPS server
server/server.go
Proxy Services
- TCP and file proxy
server/proxy/tcp.go - UDP proxy
server/proxy/udp.go - SOCKS5 proxy
server/proxy/socks5.go - HTTP and HTTPS
server/proxy/http.go - TLS proxy
server/proxy/https.go - P2P proxy
server/proxy/p2p.go
Transport and State
- Persistent configuration
lib/file/db.go - Connection transport
lib/conn/conn.go - Transport features
lib/crypt/crypt.go
Other components
- Operator
- Local services
Connections 31
- Operator → Web UI/API: manages
- Web UI/API → Login and auth: routes auth
- Web UI/API → Client management: routes client requests
- Web UI/API → Tunnel and host rules: routes rule requests
- Client management → Persistent configuration: reads and writes
- Client management → NPS server: controls clients
- Tunnel and host rules → Persistent configuration: reads and writes
- Tunnel and host rules → NPS server: starts and stops
- Dashboard → NPS server: reads status
- Dashboard → Persistent configuration: reads records
- Client configuration → NPC client: configures
- NPC client → Client bridge: connects
- Client bridge → Persistent configuration: reads client and task data
- NPS server → Client bridge: uses bridge
- NPS server → TCP and file proxy: starts mode
- NPS server → UDP proxy: starts mode
- NPS server → SOCKS5 proxy: starts mode
- NPS server → HTTP and HTTPS: starts mode
- NPS server → TLS proxy: starts mode
- NPS server → P2P proxy: starts mode
- TCP and file proxy → Client bridge: forwards traffic
- UDP proxy → Client bridge: forwards traffic
- SOCKS5 proxy → Client bridge: forwards traffic
- HTTP and HTTPS → Client bridge: forwards traffic
- TLS proxy → Client bridge: forwards traffic
- P2P proxy → Client bridge: coordinates peers
- Client bridge → NPC client: dispatches traffic
- NPC client → Local services: forwards to
- TCP and file proxy → Connection transport: uses
- NPC client → Connection transport: uses
- Connection transport → Transport features: supports