v2ray-core/common/net/testing/port.go

16 lines
200 B
Go
Raw Normal View History

2015-11-01 20:32:08 +00:00
package testing
import (
"sync/atomic"
2015-12-02 20:44:01 +00:00
v2net "github.com/v2ray/v2ray-core/common/net"
2015-11-01 20:32:08 +00:00
)
var (
port = int32(30000)
)
2015-12-02 20:44:01 +00:00
func PickPort() v2net.Port {
2015-12-06 19:38:01 +00:00
return v2net.Port(atomic.AddInt32(&port, 1))
2015-11-01 20:32:08 +00:00
}