-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fe706e
commit 22c909a
Showing
5 changed files
with
118 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,31 @@ | ||
package tun | ||
|
||
import "github.com/v2fly/v2ray-core/v5/common/net" | ||
import ( | ||
"github.com/v2fly/v2ray-core/v5/common/net" | ||
"gvisor.dev/gvisor/pkg/tcpip/stack" | ||
) | ||
|
||
type Handler interface { | ||
Handle(conn net.Conn) error | ||
var ( | ||
tcpQueue = make(chan TCPConn) | ||
udpQueue = make(chan UDPConn) | ||
) | ||
|
||
type TCPConn interface { | ||
net.Conn | ||
|
||
ID() *stack.TransportEndpointID | ||
} | ||
|
||
type UDPConn interface { | ||
net.Conn | ||
|
||
ID() *stack.TransportEndpointID | ||
} | ||
|
||
func handleTCP(conn TCPConn) { | ||
tcpQueue <- conn | ||
} | ||
|
||
func handleUDP(conn UDPConn) { | ||
udpQueue <- conn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters