MCPcopy
hub / github.com/XTLS/RealiTLScanner / NextIP

Function NextIP

utils.go:195–208  ·  view source on GitHub ↗
(ip net.IP, increment bool)

Source from the content-addressed store, hash-verified

193 return ch
194}
195func NextIP(ip net.IP, increment bool) net.IP {
196 // Convert to big.Int and increment
197 ipb := big.NewInt(0).SetBytes(ip)
198 if increment {
199 ipb.Add(ipb, big.NewInt(1))
200 } else {
201 ipb.Sub(ipb, big.NewInt(1))
202 }
203
204 // Add leading zeros
205 b := ipb.Bytes()
206 b = append(make([]byte, len(ip)-len(b)), b...)
207 return b
208}

Callers 1

IterateAddrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected