Darien Raymond 7 years ago
parent
commit
a6d81cc56d

+ 6 - 0
common/bytespool/pool.go

@@ -35,6 +35,8 @@ func init() {
 
 
 // GetPool returns a sync.Pool that generates bytes array with at least the given size.
 // GetPool returns a sync.Pool that generates bytes array with at least the given size.
 // It may return nil if no such pool exists.
 // It may return nil if no such pool exists.
+//
+// v2ray:api:stable
 func GetPool(size int32) *sync.Pool {
 func GetPool(size int32) *sync.Pool {
 	for idx, ps := range poolSize {
 	for idx, ps := range poolSize {
 		if size <= ps {
 		if size <= ps {
@@ -45,6 +47,8 @@ func GetPool(size int32) *sync.Pool {
 }
 }
 
 
 // Alloc returns a byte slice with at least the given size. Minimum size of returned slice is 2048.
 // Alloc returns a byte slice with at least the given size. Minimum size of returned slice is 2048.
+//
+// v2ray:api:stable
 func Alloc(size int32) []byte {
 func Alloc(size int32) []byte {
 	pool := GetPool(size)
 	pool := GetPool(size)
 	if pool != nil {
 	if pool != nil {
@@ -54,6 +58,8 @@ func Alloc(size int32) []byte {
 }
 }
 
 
 // Free puts a byte slice into the internal pool.
 // Free puts a byte slice into the internal pool.
+//
+// v2ray:api:stable
 func Free(b []byte) {
 func Free(b []byte) {
 	size := int32(cap(b))
 	size := int32(cap(b))
 	b = b[0:cap(b)]
 	b = b[0:cap(b)]

+ 2 - 0
transport/internet/system_listener.go

@@ -58,6 +58,8 @@ func (dl *DefaultListener) ListenPacket(ctx context.Context, addr net.Addr, sock
 
 
 // RegisterListenerController adds a controller to the effective system listener.
 // RegisterListenerController adds a controller to the effective system listener.
 // The controller can be used to operate on file descriptors before they are put into use.
 // The controller can be used to operate on file descriptors before they are put into use.
+//
+// v2ray:api:beta
 func RegisterListenerController(controller func(network, address string, fd uintptr) error) error {
 func RegisterListenerController(controller func(network, address string, fd uintptr) error) error {
 	if controller == nil {
 	if controller == nil {
 		return newError("nil listener controller")
 		return newError("nil listener controller")

+ 6 - 0
transport/internet/tcp_hub.go

@@ -52,10 +52,16 @@ func ListenTCP(ctx context.Context, address net.Address, port net.Port, settings
 	return listener, nil
 	return listener, nil
 }
 }
 
 
+// ListenSystem listens on a local address for incoming TCP connections.
+//
+// v2ray:api:beta
 func ListenSystem(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.Listener, error) {
 func ListenSystem(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.Listener, error) {
 	return effectiveListener.Listen(ctx, addr, sockopt)
 	return effectiveListener.Listen(ctx, addr, sockopt)
 }
 }
 
 
+// ListenSystemPacket listens on a local address for incoming UDP connections.
+//
+// v2ray:api:beta
 func ListenSystemPacket(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.PacketConn, error) {
 func ListenSystemPacket(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.PacketConn, error) {
 	return effectiveListener.ListenPacket(ctx, addr, sockopt)
 	return effectiveListener.ListenPacket(ctx, addr, sockopt)
 }
 }