func SubscribeRunnableChannel(c Channel) (chan interface{}, error) {
	if len(c.Subscribers()) == 0 {
		if err := c.Start(); err != nil {
			return nil, err
		}
	}
	return c.Subscribe()
}
SubscribeRunnableChannel subscribes the channel and starts it if there is first subscriber coming.
package stats
import (
	"context"
	"github.com/v2fly/v2ray-core/v4/common"
	"github.com/v2fly/v2ray-core/v4/features"
)
type Counter interface {
	Value() int64
	Set(int64) int64
	Add(int64) int64
}
type Channel interface {
	common.Runnable
	Publish(context.Context, interface{})
	Subscribers() []chan interface{}
	Subscribe() (chan interface{}, error)
	Unsubscribe(chan interface{}) error
}