forked from v2ray/v2ray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ray.go
47 lines (37 loc) · 794 Bytes
/
ray.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package core
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{
Input: make(chan []byte, bufferSize),
Output: make(chan []byte, bufferSize),
}
}
type OutboundRay interface {
OutboundInput() <-chan []byte
OutboundOutput() chan<- []byte
}
type InboundRay interface {
InboundInput() chan<- []byte
InboundOutput() <-chan []byte
}
func (ray *Ray) OutboundInput() <-chan []byte {
return ray.Input
}
func (ray *Ray) OutboundOutput() chan<- []byte {
return ray.Output
}
func (ray *Ray) InboundInput() chan<- []byte {
return ray.Input
}
func (ray *Ray) InboundOutput() <-chan []byte {
return ray.Output
}
type UDPRay struct {
}