(rawValue *uint64, defaultValue, minValue, maxValue uint64, allowZero bool)
| 1545 | } |
| 1546 | |
| 1547 | func GetRestrictedInt(rawValue *uint64, defaultValue, minValue, maxValue uint64, allowZero bool) uint64 { |
| 1548 | |
| 1549 | var value uint64 |
| 1550 | |
| 1551 | // Only use the defaultValue if rawValue isn't specified. |
| 1552 | if rawValue == nil { |
| 1553 | value = defaultValue |
| 1554 | } else { |
| 1555 | value = *rawValue |
| 1556 | } |
| 1557 | |
| 1558 | // If value is zero and allowZero=true, leave value at zero rather than forcing it to the minimum value |
| 1559 | validZero := (value == 0 && allowZero) |
| 1560 | if value < minValue && !validZero { |
| 1561 | value = minValue |
| 1562 | } |
| 1563 | |
| 1564 | if value > maxValue && maxValue > 0 { |
| 1565 | value = maxValue |
| 1566 | } |
| 1567 | |
| 1568 | return value |
| 1569 | } |
| 1570 | |
| 1571 | // GetHttpClient returns a new HTTP client with TLS certificate verification |
| 1572 | // disabled when insecureSkipVerify is true and enabled otherwise. |
no outgoing calls
no test coverage detected