Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPortFree ¶ added in v0.13.0
Asserts that the given TCP port is available to listen on, for the given (local) host; return an error if it is not.
func GetFreePort ¶ added in v0.13.0
Returns a TCP port that is available to listen on, for the given (local) host.
This works by binding a new TCP socket on port 0, which requests the OS to allocate a free port. There is no strict guarantee that the port will remain available after this function returns, but it should be safe to assume that a given port will not be allocated again to any process on this machine within a few seconds.
On Unix-based systems, binding to the port returned by this function requires setting the `SO_REUSEADDR` socket option (Go already does that by default, but other languages may not); otherwise, the OS may fail with a message such as "address already in use". Windows default behavior is already appropriate in this regard; on that platform, `SO_REUSEADDR` has a different meaning and should not be set (setting it may have unpredictable consequences).
func MaybeEscapeIPv6 ¶ added in v0.13.2
Escapes an IPv6 address with square brackets, if it is an IPv6 address.
func MustGetFreePort ¶
Returns a TCP port that is available to listen on, for the given (local) host; panics if no port is available.
This works by binding a new TCP socket on port 0, which requests the OS to allocate a free port. There is no strict guarantee that the port will remain available after this function returns, but it should be safe to assume that a given port will not be allocated again to any process on this machine within a few seconds.
On Unix-based systems, binding to the port returned by this function requires setting the `SO_REUSEADDR` socket option (Go already does that by default, but other languages may not); otherwise, the OS may fail with a message such as "address already in use". Windows default behavior is already appropriate in this regard; on that platform, `SO_REUSEADDR` has a different meaning and should not be set (setting it may have unpredictable consequences).
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func Start ¶
func Start(options StartOptions) (*Server, error)
type StartOptions ¶
type StartOptions struct { // Required fields FrontendIP string FrontendPort int Namespaces []string ClusterID string MasterClusterName string CurrentClusterName string InitialFailoverVersion int Logger *slog.Logger LogLevel slog.Level // Optional fields UIIP string // Empty means no UI UIPort int // Required if UIIP is non-empty UIAssetPath string UICodecEndpoint string PublicPath string DatabaseFile string MetricsPort int PProfPort int SqlitePragmas map[string]string FrontendHTTPPort int EnableGlobalNamespace bool DynamicConfigValues map[string]any LogConfig func([]byte) GRPCInterceptors []grpc.UnaryServerInterceptor }