1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-08-04 11:34:24 -04:00
v2fly/transport/ray/ray.go

37 lines
1.2 KiB
Go
Raw Normal View History

2015-10-14 08:51:19 -04:00
package ray
2015-09-12 16:11:54 -04:00
import (
"github.com/v2ray/v2ray-core/common/alloc"
)
2015-10-10 06:46:44 -04:00
// OutboundRay is a transport interface for outbound connections.
2015-09-12 16:11:54 -04:00
type OutboundRay interface {
2015-10-10 06:46:44 -04:00
// OutboundInput provides a stream for the input of the outbound connection.
// The outbound connection shall write all the input until it is closed.
OutboundInput() <-chan *alloc.Buffer
2015-10-10 06:46:44 -04: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.
OutboundOutput() chan<- *alloc.Buffer
2015-09-12 16:11:54 -04:00
}
2015-10-10 06:46:44 -04:00
// InboundRay is a transport interface for inbound connections.
2015-09-12 16:11:54 -04:00
type InboundRay interface {
2015-10-10 06:46:44 -04: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.
InboundInput() chan<- *alloc.Buffer
2015-10-10 06:46:44 -04: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.
InboundOutput() <-chan *alloc.Buffer
2015-09-12 16:11:54 -04:00
}
2015-10-14 08:51:19 -04:00
// Ray is an internal tranport channel bewteen inbound and outbound connection.
type Ray interface {
InboundRay
OutboundRay
}