disable producer/consumer
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2021-04-09 18:50:00 +01:00
parent ca2f3060db
commit 1cf9cc880d
2 changed files with 15 additions and 4 deletions

View File

@ -75,8 +75,12 @@ func buildTcp(ctx context.Context, p *proxy.Proxy, peer Peer, g func() proxy.Mac
return err return err
} }
p.AddConsumer(ctx, f, g()) if !peer.DisableConsumer {
p.AddProducer(ctx, f, v()) p.AddConsumer(ctx, f, g())
}
if !peer.DisableProducer {
p.AddProducer(ctx, f, v())
}
return nil return nil
} }
@ -121,8 +125,12 @@ func buildUdp(ctx context.Context, p *proxy.Proxy, peer Peer, g func() proxy.Mac
return err return err
} }
p.AddConsumer(ctx, f, g()) if !peer.DisableConsumer {
p.AddProducer(ctx, f, v()) p.AddConsumer(ctx, f, g())
}
if !peer.DisableProducer {
p.AddProducer(ctx, f, v())
}
return nil return nil
} }

View File

@ -57,6 +57,9 @@ type Peer struct {
KeepAlive uint KeepAlive uint
Timeout uint Timeout uint
RetryWait uint RetryWait uint
DisableConsumer bool `validate:"omitempty,nefield=DisableProducer"`
DisableProducer bool `validate:"omitempty,nefield=DisableConsumer"`
} }
func (p Peer) GetLocalHost() string { func (p Peer) GetLocalHost() string {