-
Notifications
You must be signed in to change notification settings - Fork 0
/
ray.go
50 lines (41 loc) · 1.37 KB
/
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
48
49
50
package ray
import "v2ray.com/core/common/buf"
// OutboundRay is a transport interface for outbound connections.
type OutboundRay interface {
// OutboundInput provides a stream for the input of the outbound connection.
// The outbound connection shall write all the input until it is closed.
OutboundInput() InputStream
// OutboundOutput provides a stream to retrieve the response from the
// outbound connection. The outbound connection shall close the channel
// after all responses are receivced and put into the channel.
OutboundOutput() OutputStream
}
// InboundRay is a transport interface for inbound connections.
type InboundRay interface {
// InboundInput provides a stream to retrieve the request from client.
// The inbound connection shall close the channel after the entire request
// is received and put into the channel.
InboundInput() OutputStream
// InboudBound provides a stream of data for the inbound connection to write
// as response. The inbound connection shall write all the data from the
// channel until it is closed.
InboundOutput() InputStream
}
// Ray is an internal tranport channel between inbound and outbound connection.
type Ray interface {
InboundRay
OutboundRay
}
type RayStream interface {
Close()
CloseError()
}
type InputStream interface {
buf.Reader
buf.TimeoutReader
RayStream
}
type OutputStream interface {
buf.Writer
RayStream
}