network port
parent
61ef62e23d
commit
f58be2f83d
|
@ -26,6 +26,11 @@ func NetAddr() net.Addr {
|
|||
return Default.NetAddr()
|
||||
}
|
||||
|
||||
// NetPort returns an arbitrary network port.
|
||||
func NetPort() uint16 {
|
||||
return Default.NetPort()
|
||||
}
|
||||
|
||||
// Password returns an arbitrary password.
|
||||
func Password() string {
|
||||
return Default.Password()
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package arbitrary
|
||||
|
||||
// NetPort returns an arbitrary network port.
|
||||
func (arb T) NetPort() uint16 {
|
||||
|
||||
var port uint16
|
||||
{
|
||||
port = uint16(arb.randomness.Intn(65536))
|
||||
|
||||
if 0 == arb.randomness.Intn(5) {
|
||||
port = uint16(arb.randomness.Intn(1024))
|
||||
}
|
||||
|
||||
if 0 == arb.randomness.Intn(4) {
|
||||
port = uint16(arb.randomness.Intn(100))
|
||||
}
|
||||
|
||||
if 0 == arb.randomness.Intn(30) {
|
||||
port = 80
|
||||
}
|
||||
if 0 == arb.randomness.Intn(29) {
|
||||
port = 79
|
||||
}
|
||||
}
|
||||
|
||||
return port
|
||||
}
|
Loading…
Reference in New Issue