How v2fly/v2ray-core works
Project V (V2Ray Core) is a configurable network proxy platform for building private, secured connections. The main runtime path accepts inbound traffic, processes a proxy protocol, dispatches destination traffic through routing, and sends it through an outbound handler and transport. The repository also contains DNS, policy, statistics, subscription management, management APIs, TUN support, and optional networking capabilities. Several edges below are grounded in sampled source or the source index; links for unsampled subsystems are omitted rather than inferred.
Main entry points: dispatcher.go Traffic dispatcher · proxy Inbound protocols · worker.go Inbound workers · router.go Routing rules
Components 20
Traffic runtime
- Inbound workers
app/proxyman/inbound/worker.go - Inbound protocols
proxy - Routing rules
app/router/router.go - Traffic dispatcher
features/routing/dispatcher.go - Outbound handlers
app/proxyman/outbound/handler.go - Transport connections
transport/internet/internet.go
Network services
- DNS services
app/dns/dns.go - Session policy
app/policy/manager.go - Traffic statistics
app/stats/stats.go - TUN networking
app/tun/tun.go - Reverse proxy
app/reverse/reverse.go
Management
- Subscriptions
app/subscription/subscriptionmanager/manager.go - Persistent storage
app/persistentstorage/storage.go - REST management
app/restfulapi/service.go - Runtime commands
app/commander/service.go
Optional capabilities
- Connectivity observatory
app/observatory/observatory.go - WebRTC transport
app/webrtc/webrtc.go - Browser forwarding
app/browserforwarder/forwarder.go
Other components
- Network client
- Destination service
Connections 15
- Network client → Inbound workers: connects
- Inbound workers → Inbound protocols: invokes handlers
app/proxyman/inbound/worker.go - Inbound protocols → Traffic dispatcher: dispatches traffic
proxy/http/server.go - Inbound protocols → Traffic dispatcher: dispatches UDP
proxy/socks/server.go - Routing rules → Traffic dispatcher: implements routing
app/router/router.go - Traffic dispatcher → Outbound handlers: selects outbound
- Outbound handlers → Transport connections: uses transport
app/proxyman/outbound/handler.go - Transport connections → Destination service: connects to
- Inbound protocols → Session policy: gets session policy
proxy/http/server.go - Inbound workers → Routing rules: uses dispatcher
app/proxyman/inbound/worker.go - Routing rules → DNS services: uses DNS
app/router/router.go - TUN networking → Traffic dispatcher: dispatches traffic
- Subscriptions → Persistent storage: persists imports
app/subscription/subscriptionmanager/manager.go - REST management → Traffic statistics: exposes statistics
app/restfulapi/service.go - Runtime commands → REST management: registers commands