1 package ldcomponents 2 3 import "github.com/launchdarkly/go-server-sdk/v6/interfaces" 4 5 // RelayProxyEndpoints specifies a single base URI for a Relay Proxy instance, telling the SDK to 6 // use the Relay Proxy for all services. 7 // 8 // When using the LaunchDarkly Relay Proxy (https://docs.launchdarkly.com/home/relay-proxy), the SDK 9 // only needs to know the single base URI of the Relay Proxy, which will provide all of the proxied 10 // service endpoints. 11 // 12 // Store this value in the ServiceEndpoints field of [github.com/launchdarkly/go-server-sdk/v6.Config]. 13 // For example: 14 // 15 // relayURI := "http://my-relay-hostname:8080" 16 // config := ld.Config{ 17 // ServiceEndpoints: ldcomponents.RelayProxyEndpoints(relayURI), 18 // } 19 // 20 // If analytics events are enabled, this will also cause the SDK to forward events through the 21 // Relay Proxy. If you have not enabled event forwarding in your Relay Proxy configuration and you 22 // want the SDK to send events directly to LaunchDarkly instead, use [RelayProxyEndpointsWithoutEvents]. 23 // 24 // See Config.ServiceEndpoints for more details. 25 func RelayProxyEndpoints(relayProxyBaseURI string) interfaces.ServiceEndpoints { 26 return interfaces.ServiceEndpoints{ 27 Streaming: relayProxyBaseURI, 28 Polling: relayProxyBaseURI, 29 Events: relayProxyBaseURI, 30 } 31 } 32 33 // RelayProxyEndpointsWithoutEvents specifies a single base URI for a Relay Proxy instance, telling 34 // the SDK to use the Relay Proxy for all services except analytics events. 35 // 36 // When using the LaunchDarkly Relay Proxy (https://docs.launchdarkly.com/home/relay-proxy), the SDK 37 // only needs to know the single base URI of the Relay Proxy, which will provide all of the proxied 38 // service endpoints. 39 // 40 // Store this value in the ServiceEndpoints field of your SDK configuration. For example: 41 // 42 // relayURI := "http://my-relay-hostname:8080" 43 // config := ld.Config{ 44 // ServiceEndpoints: ldcomponents.RelayProxyEndpointsWithoutEvents(relayURI), 45 // } 46 // 47 // If you do want events to be forwarded through the Relay Proxy, use [RelayProxyEndpoints] instead. 48 // 49 // See Config.ServiceEndpoints for more details. 50 func RelayProxyEndpointsWithoutEvents(relayProxyBaseURI string) interfaces.ServiceEndpoints { 51 return interfaces.ServiceEndpoints{ 52 Streaming: relayProxyBaseURI, 53 Polling: relayProxyBaseURI, 54 } 55 } 56