mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-21 15:08:08 +00:00
Introduce Packet to unify TCP and UDP communication
This commit is contained in:
1 parent
4320c14efd
commit
4874cd54a4
12 files changed
+124
-41
No files matched your search
@@ -4,13 +4,14 @@ const (
|
||||
bufferSize = 16
|
||||
)
|
||||
|
||||
// Ray is an internal tranport channel bewteen inbound and outbound connection.
|
||||
type Ray struct {
|
||||
Input chan []byte
|
||||
Output chan []byte
|
||||
}
|
||||
|
||||
func NewRay() Ray {
|
||||
return Ray{
|
||||
func NewRay() *Ray {
|
||||
return &Ray{
|
||||
Input: make(chan []byte, bufferSize),
|
||||
Output: make(chan []byte, bufferSize),
|
||||
}
|
||||
@@ -26,18 +27,21 @@ type InboundRay interface {
|
||||
InboundOutput() <-chan []byte
|
||||
}
|
||||
|
||||
func (ray Ray) OutboundInput() <-chan []byte {
|
||||
func (ray *Ray) OutboundInput() <-chan []byte {
|
||||
return ray.Input
|
||||
}
|
||||
|
||||
func (ray Ray) OutboundOutput() chan<- []byte {
|
||||
func (ray *Ray) OutboundOutput() chan<- []byte {
|
||||
return ray.Output
|
||||
}
|
||||
|
||||
func (ray Ray) InboundInput() chan<- []byte {
|
||||
func (ray *Ray) InboundInput() chan<- []byte {
|
||||
return ray.Input
|
||||
}
|
||||
|
||||
func (ray Ray) InboundOutput() <-chan []byte {
|
||||
func (ray *Ray) InboundOutput() <-chan []byte {
|
||||
return ray.Output
|
||||
}
|
||||
|
||||
type UDPRay struct {
|
||||
}
|
||||
Reference in new issue
Block a user