1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-08 06:14:23 -04:00
v2fly/transport/ray/ray.go

47 lines
1.3 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 (
2016-04-18 12:44:10 -04:00
v2io "github.com/v2ray/v2ray-core/common/io"
)
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.
2016-04-18 12:44:10 -04:00
OutboundInput() InputStream
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.
2016-04-18 12:44:10 -04:00
OutboundOutput() OutputStream
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.
2016-04-18 12:44:10 -04:00
InboundInput() OutputStream
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.
2016-04-18 12:44:10 -04:00
InboundOutput() InputStream
2015-09-12 16:11:54 -04:00
}
2016-02-05 16:04:43 -05:00
// Ray is an internal tranport channel between inbound and outbound connection.
2015-10-14 08:51:19 -04:00
type Ray interface {
InboundRay
OutboundRay
}
2016-04-18 12:44:10 -04:00
type InputStream interface {
v2io.Reader
Close()
}
type OutputStream interface {
v2io.Writer
Close()
}