本文整理匯總了Golang中v2ray/com/core/common/net.Destination.String方法的典型用法代碼示例。如果您正苦於以下問題:Golang Destination.String方法的具體用法?Golang Destination.String怎麽用?Golang Destination.String使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類v2ray/com/core/common/net.Destination
的用法示例。
在下文中一共展示了Destination.String方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Destination
func (v *Assert) Destination(value v2net.Destination) *DestinationSubject {
return &DestinationSubject{
Subject: Subject{
disp: value.String(),
a: v,
},
value: value,
}
}
示例2: TakeDetour
func (this *Router) TakeDetour(dest v2net.Destination) (string, error) {
destStr := dest.String()
found, tag, err := this.cache.Get(destStr)
if !found {
tag, err := this.takeDetourWithoutCache(dest)
this.cache.Set(destStr, tag, err)
return tag, err
}
return tag, err
}
示例3: getInboundRay
func (v *Dispatcher) getInboundRay(ctx context.Context, dest v2net.Destination) (ray.InboundRay, bool) {
destString := dest.String()
v.Lock()
defer v.Unlock()
if entry, found := v.conns[destString]; found {
return entry, true
}
log.Info("UDP|Server: establishing new connection for ", dest)
ctx = proxy.ContextWithDestination(ctx, dest)
return v.packetDispatcher.DispatchToOutbound(ctx), false
}
示例4: Dispatch
func (v *Dispatcher) Dispatch(ctx context.Context, destination v2net.Destination, payload *buf.Buffer, callback ResponseCallback) {
// TODO: Add user to destString
destString := destination.String()
log.Debug("UDP|Server: Dispatch request: ", destString)
inboundRay, existing := v.getInboundRay(ctx, destination)
outputStream := inboundRay.InboundInput()
if outputStream != nil {
if err := outputStream.Write(payload); err != nil {
v.RemoveRay(destString)
}
}
if !existing {
go func() {
handleInput(inboundRay.InboundOutput(), callback)
v.RemoveRay(destString)
}()
}
}