本文整理汇总了Golang中github.com/v2ray/v2ray-core/transport/ray.InboundRay类的典型用法代码示例。如果您正苦于以下问题:Golang InboundRay类的具体用法?Golang InboundRay怎么用?Golang InboundRay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InboundRay类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleConnection
func (this *UDPServer) handleConnection(destString string, inboundRay ray.InboundRay, source v2net.Destination, callback UDPResponseCallback) {
for buffer := range inboundRay.InboundOutput() {
callback(v2net.NewPacket(source, buffer, false))
}
this.Lock()
delete(this.conns, destString)
this.Unlock()
}
示例2: transport
func (this *HttpProxyServer) transport(input io.Reader, output io.Writer, ray ray.InboundRay) {
var wg sync.WaitGroup
wg.Add(2)
defer wg.Wait()
go func() {
v2io.RawReaderToChan(ray.InboundInput(), input)
close(ray.InboundInput())
wg.Done()
}()
go func() {
v2io.ChanToWriter(output, ray.InboundOutput())
wg.Done()
}()
}
示例3: transport
func (this *Server) transport(input io.Reader, output io.Writer, ray ray.InboundRay) {
var wg sync.WaitGroup
wg.Add(2)
defer wg.Wait()
go func() {
v2reader := v2io.NewAdaptiveReader(input)
defer v2reader.Release()
v2io.Pipe(v2reader, ray.InboundInput())
ray.InboundInput().Close()
wg.Done()
}()
go func() {
v2writer := v2io.NewAdaptiveWriter(output)
defer v2writer.Release()
v2io.Pipe(ray.InboundOutput(), v2writer)
ray.InboundOutput().Release()
wg.Done()
}()
}