Skip to content

Commit

Permalink
RELAY_ALLOW_PDS_PROXY -allow-pds-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Jan 8, 2025
1 parent 020c156 commit 7a00551
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bgs/bgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ type BGSConfig struct {
ConcurrencyPerPDS int64
MaxQueuePerPDS int64
NumCompactionWorkers int

VerboseAPILog bool
VerboseAPILog bool
AllowPDSProxies bool

// NextCrawlers gets forwarded POST /xrpc/com.atproto.sync.requestCrawl
NextCrawlers []*url.URL
Expand Down Expand Up @@ -946,7 +946,7 @@ func (bgs *BGS) handleFedEvent(ctx context.Context, host *models.PDS, env *event
return fmt.Errorf("rebase was true in event seq:%d,host:%s", evt.Seq, host.Host)
}

if host.ID != u.PDS && u.PDS != 0 {
if host.ID != u.PDS && u.PDS != 0 && !bgs.config.AllowPDSProxies {
bgs.log.Warn("received event for repo from different pds than expected", "repo", evt.Repo, "expPds", u.PDS, "gotPds", host.Host)
// Flush any cached DID documents for this user
bgs.didr.FlushCacheFor(env.RepoCommit.Repo)
Expand Down
7 changes: 7 additions & 0 deletions cmd/bigsky/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ func run(args []string) error {
Value: "prod",
EnvVars: []string{"RELAY_CRAWL_NONSSL"},
},
&cli.BoolFlag{
Name: "allow-pds-proxy",
Usage: "allow getting PDS data from a non-canonical source (e.g. another relay)",
Value: true,
EnvVars: []string{"RELAY_ALLOW_PDS_PROXY"},
},
&cli.BoolFlag{
Name: "spidering",
Value: false,
Expand Down Expand Up @@ -493,6 +499,7 @@ func runBigsky(cctx *cli.Context) error {
default:
return fmt.Errorf("crawl-insecure-ws/RELAY_CRAWL_NONSSL exepected true|false|prod, got %s", cctx.String("crawl-insecure-ws"))
}
bgsConfig.AllowPDSProxies = cctx.Bool("allow-pds-proxy")
bgsConfig.CompactInterval = cctx.Duration("compact-interval")
bgsConfig.ConcurrencyPerPDS = cctx.Int64("concurrency-per-pds")
bgsConfig.MaxQueuePerPDS = cctx.Int64("max-queue-per-pds")
Expand Down

0 comments on commit 7a00551

Please # to comment.