Implement server whitelist

This commit is contained in:
enaix 2025-01-16 12:31:37 +03:00
parent add73ec866
commit b2ecd5648c
14 changed files with 332 additions and 0 deletions

View file

@ -46,6 +46,12 @@ type FederationAPI struct {
// Should we prefer direct key fetches over perspective ones?
PreferDirectFetch bool `yaml:"prefer_direct_fetch"`
// Enable servers whitelist function
EnableWhitelist bool `yaml:"enable_whitelist"`
// The list of whitelisted servers
WhitelistedServers []spec.ServerName `yaml:"whitelisted_servers"`
}
func (c *FederationAPI) Defaults(opts DefaultOpts) {
@ -73,6 +79,8 @@ func (c *FederationAPI) Defaults(opts DefaultOpts) {
c.Database.ConnectionString = "file:federationapi.db"
}
}
c.EnableWhitelist = false
c.WhitelistedServers = make([]spec.ServerName, 0)
}
func (c *FederationAPI) Verify(configErrs *ConfigErrors) {