v2ray-core/transport/ray/ray.go

52 lines
1.4 KiB
Go
Raw Normal View History

2015-10-14 12:51:19 +00:00
package ray
2015-09-12 20:11:54 +00:00
2016-12-09 12:17:34 +00:00
import "v2ray.com/core/common/buf"
2015-10-10 10:46:44 +00:00
// OutboundRay is a transport interface for outbound connections.
2015-09-12 20:11:54 +00:00
type OutboundRay interface {
2015-10-10 10:46:44 +00:00
// OutboundInput provides a stream for the input of the outbound connection.
// The outbound connection shall write all the input until it is closed.
2016-04-18 16:44:10 +00:00
OutboundInput() InputStream
2015-10-10 10:46:44 +00:00
// 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.
2016-04-18 16:44:10 +00:00
OutboundOutput() OutputStream
2015-09-12 20:11:54 +00:00
}
2015-10-10 10:46:44 +00:00
// InboundRay is a transport interface for inbound connections.
2015-09-12 20:11:54 +00:00
type InboundRay interface {
2015-10-10 10:46:44 +00:00
// 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.
2016-04-18 16:44:10 +00:00
InboundInput() OutputStream
2015-10-10 10:46:44 +00:00
// 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.
2016-04-18 16:44:10 +00:00
InboundOutput() InputStream
2015-09-12 20:11:54 +00:00
}
2016-02-05 21:04:43 +00:00
// Ray is an internal tranport channel between inbound and outbound connection.
2015-10-14 12:51:19 +00:00
type Ray interface {
InboundRay
OutboundRay
}
2016-04-18 16:44:10 +00:00
2017-01-10 13:22:42 +00:00
type RayStream interface {
Close()
CloseError()
}
2016-04-18 16:44:10 +00:00
type InputStream interface {
2016-12-09 12:17:34 +00:00
buf.Reader
2017-04-02 23:06:49 +00:00
buf.TimeoutReader
2017-01-10 13:22:42 +00:00
RayStream
2017-04-25 08:48:06 +00:00
Peek(*buf.Buffer)
2016-04-18 16:44:10 +00:00
}
type OutputStream interface {
2016-12-09 12:17:34 +00:00
buf.Writer
2017-01-10 13:22:42 +00:00
RayStream
2016-04-18 16:44:10 +00:00
}