diff --git a/cmd/livepeer/livepeer.go b/cmd/livepeer/livepeer.go index 988101419..fc2c9d4a5 100755 --- a/cmd/livepeer/livepeer.go +++ b/cmd/livepeer/livepeer.go @@ -139,6 +139,7 @@ func parseLivepeerConfig() starter.LivepeerConfig { cfg.IgnoreMaxPriceIfNeeded = flag.Bool("ignoreMaxPriceIfNeeded", *cfg.IgnoreMaxPriceIfNeeded, "Set to true to allow exceeding max price condition if there is no O that meets this requirement") cfg.MinPerfScore = flag.Float64("minPerfScore", *cfg.MinPerfScore, "The minimum orchestrator's performance score a broadcaster is willing to accept") cfg.DiscoveryTimeout = flag.Duration("discoveryTimeout", *cfg.DiscoveryTimeout, "Time to wait for orchestrators to return info to be included in transcoding sessions for manifest (default = 500ms)") + cfg.GatewayHost = flag.String("gatewayHost", *cfg.GatewayHost, "External hostname on which the Gateway node is running. Used when telling external services how to reach the node.") // Transcoding: cfg.Orchestrator = flag.Bool("orchestrator", *cfg.Orchestrator, "Set to true to be an orchestrator") diff --git a/cmd/livepeer/starter/starter.go b/cmd/livepeer/starter/starter.go index 9489d2807..78dfc96f4 100755 --- a/cmd/livepeer/starter/starter.go +++ b/cmd/livepeer/starter/starter.go @@ -116,6 +116,7 @@ type LivepeerConfig struct { Netint *string HevcDecoding *bool TestTranscoder *bool + GatewayHost *string EthAcctAddr *string EthPassword *string EthKeystorePath *string @@ -215,6 +216,7 @@ func DefaultLivepeerConfig() LivepeerConfig { defaultAIRunnerImage := "livepeer/ai-runner:latest" defaultLiveAIAuthWebhookURL := "" defaultLivePaymentInterval := 5 * time.Second + defaultGatewayHost := "" // Onchain: defaultEthAcctAddr := "" @@ -323,6 +325,7 @@ func DefaultLivepeerConfig() LivepeerConfig { AIRunnerImage: &defaultAIRunnerImage, LiveAIAuthWebhookURL: &defaultLiveAIAuthWebhookURL, LivePaymentInterval: &defaultLivePaymentInterval, + GatewayHost: &defaultGatewayHost, // Onchain: EthAcctAddr: &defaultEthAcctAddr, @@ -1414,6 +1417,10 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) { *cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", BroadcasterRpcPort) *cfg.CliAddr = defaultAddr(*cfg.CliAddr, "127.0.0.1", BroadcasterCliPort) + if *cfg.GatewayHost != "" { + n.GatewayHost = *cfg.GatewayHost + } + bcast := core.NewBroadcaster(n) orchBlacklist := parseOrchBlacklist(cfg.OrchBlacklist) if *cfg.OrchPerfStatsURL != "" && *cfg.Region != "" { diff --git a/core/livepeernode.go b/core/livepeernode.go index 93f79b3ab..40cfa53fe 100644 --- a/core/livepeernode.go +++ b/core/livepeernode.go @@ -157,6 +157,9 @@ type LivepeerNode struct { LiveAITrickleHostForRunner string LiveAIAuthApiKey string LivePaymentInterval time.Duration + + // Gateway + GatewayHost string } type LivePipeline struct { diff --git a/server/ai_mediaserver.go b/server/ai_mediaserver.go index 5191c412f..dc1a43c8d 100644 --- a/server/ai_mediaserver.go +++ b/server/ai_mediaserver.go @@ -446,6 +446,7 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler { Stream: streamName, Type: sourceTypeStr, QueryParams: queryParams, + GatewayHost: ls.LivepeerNode.GatewayHost, }) if err != nil { kickErr := mediaMTXClient.KickInputConnection(ctx) diff --git a/server/auth.go b/server/auth.go index 5d768f97b..400e29742 100644 --- a/server/auth.go +++ b/server/auth.go @@ -107,6 +107,9 @@ type AIAuthRequest struct { // Query parameters that came with the stream, if any QueryParams string `json:"query_params,omitempty"` + // Gateway host + GatewayHost string `json:"gateway_host"` + // TODO not sure what params we need yet }