1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

fix nil address in inbound proxyman

This commit is contained in:
Darien Raymond 2017-01-27 23:52:29 +01:00
parent 09e5ae7a4b
commit c5ecdc8078
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 13 additions and 5 deletions

View File

@ -27,11 +27,15 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
nl := p.Network()
pr := receiverConfig.PortRange
address := receiverConfig.Listen.AsAddress()
if address == nil {
address = net.AnyIP
}
for port := pr.From; port <= pr.To; port++ {
if nl.HasNetwork(net.Network_TCP) {
log.Debug("Proxyman|DefaultInboundHandler: creating tcp worker on ", receiverConfig.Listen.AsAddress(), ":", port)
log.Debug("Proxyman|DefaultInboundHandler: creating tcp worker on ", address, ":", port)
worker := &tcpWorker{
address: receiverConfig.Listen.AsAddress(),
address: address,
port: net.Port(port),
proxy: p,
stream: receiverConfig.StreamSettings,
@ -46,7 +50,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
worker := &udpWorker{
tag: tag,
proxy: p,
address: receiverConfig.Listen.AsAddress(),
address: address,
port: net.Port(port),
recvOrigDest: receiverConfig.ReceiveOriginalDestination,
}

View File

@ -73,6 +73,10 @@ func (h *DynamicInboundHandler) refresh() error {
h.worker2Recycle, h.worker = h.worker, h.worker2Recycle[:0]
address := h.receiverConfig.Listen.AsAddress()
if address == nil {
address = v2net.AnyIP
}
for i := uint32(0); i < h.receiverConfig.AllocationStrategy.GetConcurrencyValue(); i++ {
port := h.allocatePort()
p, err := proxy.CreateInboundHandler(h.ctx, h.proxyConfig)
@ -84,7 +88,7 @@ func (h *DynamicInboundHandler) refresh() error {
if nl.HasNetwork(v2net.Network_TCP) {
worker := &tcpWorker{
tag: h.tag,
address: h.receiverConfig.Listen.AsAddress(),
address: address,
port: port,
proxy: p,
stream: h.receiverConfig.StreamSettings,
@ -101,7 +105,7 @@ func (h *DynamicInboundHandler) refresh() error {
worker := &udpWorker{
tag: h.tag,
proxy: p,
address: h.receiverConfig.Listen.AsAddress(),
address: address,
port: port,
recvOrigDest: h.receiverConfig.ReceiveOriginalDestination,
}