...

Package endpoints

import "github.com/launchdarkly/go-server-sdk/v6/internal/endpoints"
Overview
Index

Overview ▾

Package endpoints contains internal constants and functions for computing service endpoint URIs.

Constants

const (
    // DefaultStreamingBaseURI is the default base URI of the streaming service.
    DefaultStreamingBaseURI = "https://stream.launchdarkly.com/"

    // DefaultPollingBaseURI is the default base URI of the polling service.
    DefaultPollingBaseURI = "https://sdk.launchdarkly.com/"

    // DefaultEventsBaseURI is the default base URI of the events service.
    DefaultEventsBaseURI = "https://events.launchdarkly.com/"

    // StreamingRequestPath is the URL path for the server-side streaming endpoint.
    StreamingRequestPath = "/all"

    // PollingRequestPath is the URL path for the server-side polling endpoint.
    PollingRequestPath = "/sdk/latest-all"
)

func AddPath

func AddPath(baseURI string, path string) string

AddPath concatenates a subpath to a URL in a way that will not cause a double slash.

func DefaultBaseURI

func DefaultBaseURI(serviceType ServiceType) string

DefaultBaseURI returns the default base URI for the given kind of endpoint.

func IsCustom

func IsCustom(serviceEndpoints interfaces.ServiceEndpoints, serviceType ServiceType, overrideValue string) bool

IsCustom returns true if the service endpoint has been overridden with a non-default value.

func SelectBaseURI

func SelectBaseURI(
    serviceEndpoints interfaces.ServiceEndpoints,
    serviceType ServiceType,
    overrideValue string,
    loggers ldlog.Loggers,
) string

SelectBaseURI is a helper for getting either a custom or a default URI for the given kind of endpoint.

type ServiceType

ServiceType is used internally to denote which endpoint a URI is for.

type ServiceType int
const (
    StreamingService ServiceType = iota //nolint:revive // don't really need doc comments here
    PollingService   ServiceType = iota
    EventsService    ServiceType = iota
)

func (ServiceType) String

func (s ServiceType) String() string