v2ray-core/transport/ray/direct.go

39 lines
715 B
Go
Raw Normal View History

2015-10-14 13:07:13 +00:00
package ray
import (
"github.com/v2ray/v2ray-core/common/alloc"
)
const (
bufferSize = 16
)
2015-10-15 11:15:59 +00:00
// NewRay creates a new Ray for direct traffic transport.
2015-10-14 13:07:13 +00:00
func NewRay() Ray {
return &directRay{
Input: make(chan *alloc.Buffer, bufferSize),
Output: make(chan *alloc.Buffer, bufferSize),
}
}
type directRay struct {
Input chan *alloc.Buffer
Output chan *alloc.Buffer
}
2015-11-27 20:57:15 +00:00
func (this *directRay) OutboundInput() <-chan *alloc.Buffer {
return this.Input
2015-10-14 13:07:13 +00:00
}
2015-11-27 20:57:15 +00:00
func (this *directRay) OutboundOutput() chan<- *alloc.Buffer {
return this.Output
2015-10-14 13:07:13 +00:00
}
2015-11-27 20:57:15 +00:00
func (this *directRay) InboundInput() chan<- *alloc.Buffer {
return this.Input
2015-10-14 13:07:13 +00:00
}
2015-11-27 20:57:15 +00:00
func (this *directRay) InboundOutput() <-chan *alloc.Buffer {
return this.Output
2015-10-14 13:07:13 +00:00
}