set static ports by default for server, with dynamic prots option

This commit is contained in:
Felipe Madero
2022-09-26 17:48:35 -03:00
parent 9954528219
commit b91399c2cd
6 changed files with 399 additions and 363 deletions
+8
View File
@@ -123,6 +123,7 @@ func (c *client) Start(ctx context.Context, execPath string, opts ...OpOption) (
req.CustomNodeConfigs = ret.customNodeConfigs
}
req.ReassignPortsIfUsed = &ret.reassignPortsIfUsed
req.DynamicPorts = &ret.dynamicPorts
c.log.Info("start")
return c.controlc.Start(ctx, req)
@@ -340,6 +341,7 @@ type Op struct {
chainConfigs map[string]string
upgradeConfigs map[string]string
reassignPortsIfUsed bool
dynamicPorts bool
}
type OpOption func(*Op)
@@ -426,6 +428,12 @@ func WithReassignPortsIfUsed(reassignPortsIfUsed bool) OpOption {
}
}
func WithDynamicPorts(dynamicPorts bool) OpOption {
return func(op *Op) {
op.dynamicPorts = dynamicPorts
}
}
func isClientCanceled(ctxErr error, err error) bool {
if ctxErr != nil {
return true