Live video on the AT Protocol

config: add --syndicate command line flag

+18
+14
pkg/config/config.go
··· 135 135 WebsocketURL string 136 136 BehindHTTPSProxy bool 137 137 SegmentDebugDir string 138 + Syndicate []string 138 139 } 139 140 140 141 // ContentFilters represents the content filtering configuration ··· 229 230 cli.StringSliceFlag(fs, &cli.Replicators, "replicators", []string{ReplicatorWebsocket}, "list of replication protocols to use (http, iroh)") 230 231 fs.StringVar(&cli.WebsocketURL, "websocket-url", "", "override the websocket (ws:// or wss://) url to use for replication (normally not necessary, used for testing)") 231 232 fs.BoolVar(&cli.BehindHTTPSProxy, "behind-https-proxy", false, "set to true if this node is behind an https proxy and we should report https URLs even though the node isn't serving HTTPS") 233 + cli.StringSliceFlag(fs, &cli.Syndicate, "syndicate", []string{}, "list of DIDs that we should rebroadcast ('*' for everybody)") 232 234 233 235 fs.Bool("external-signing", true, "DEPRECATED, does nothing.") 234 236 fs.Bool("insecure", false, "DEPRECATED, does nothing.") ··· 674 676 log.Log(ctx, "wrote debug file", "path", outFile) 675 677 }() 676 678 } 679 + 680 + func (cli *CLI) ShouldSyndicate(did string) bool { 681 + for _, d := range cli.Syndicate { 682 + if d == "*" { 683 + return true 684 + } 685 + if d == did { 686 + return true 687 + } 688 + } 689 + return false 690 + }
+4
pkg/replication/websocketrep/websocket_replicator.go
··· 83 83 if origin.WebsocketURL == nil { 84 84 return fmt.Errorf("origin has no websocket URL author=%s", view.Author.Did) 85 85 } 86 + if !r.cli.ShouldSyndicate(origin.Streamer) { 87 + log.Debug(ctx, "not replicating streamer", "streamer", origin.Streamer) 88 + return nil 89 + } 86 90 if r.hasConnection(origin.Streamer) { 87 91 log.Debug(ctx, "already has connection") 88 92 return nil