Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --unique, -u for randip #76

Merged
merged 6 commits into from
Nov 19, 2021
Merged

Added --unique, -u for randip #76

merged 6 commits into from
Nov 19, 2021

Conversation

rm-Umar
Copy link
Contributor

@rm-Umar rm-Umar commented Nov 18, 2021

Added a new flag in randip for generating only unique IPs.

./randip -s 127.0.0.0 -e 127.0.0.5 -n 5 -u 
127.0.0.3
127.0.0.4
127.0.0.0
127.0.0.1
127.0.0.2

ipinfo/cmd_randip.go Outdated Show resolved Hide resolved
lib/ip.go Outdated Show resolved Hide resolved
lib/ip.go Outdated Show resolved Hide resolved
lib/ip.go Outdated Show resolved Hide resolved
@UmanShahzad
Copy link
Contributor

Getting an error, seems due to overflow when you do the +1:

$ ./build/randip 
panic: runtime error: integer divide by zero

goroutine 1 [running]:
github.com/ipinfo/cli/lib.RandIP4Range(0xffffffff00000000, 0x0, 0x5cee84, 0xf, 0xffffffff00000000, 0x0, 0x0)
	/home/mslm/dev/ipinfo/cli/lib/ip.go:142 +0x178
github.com/ipinfo/cli/lib.RandIP4RangeListWrite(0x5cd057, 0x7, 0x5cee84, 0xf, 0x1, 0x5d0000, 0x5715a0, 0xc0000ca000)
	/home/mslm/dev/ipinfo/cli/lib/ip.go:195 +0x3e6
github.com/ipinfo/cli/lib.CmdRandIP(0x0, 0x1, 0x1, 0x5cd057, 0x7, 0x5cee84, 0xf, 0x726690, 0x0, 0x0, ...)
	/home/mslm/dev/ipinfo/cli/lib/cmd_randip.go:90 +0x134
main.cmd(0x7ffc79b7cc8d, 0x6)
	/home/mslm/dev/ipinfo/cli/randip/main.go:146 +0x485
main.main()
	/home/mslm/dev/ipinfo/cli/randip/main.go:157 +0x85

randip/main.go Outdated Show resolved Hide resolved
@UmanShahzad UmanShahzad merged commit 0385085 into ipinfo:master Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants