Documentation
¶
Index ¶
- Variables
- func CreateDERPMeshTLSConfig(hostname string, tlsCertificates []tls.Certificate) (*tls.Config, error)
- func PingPeerReplica(ctx context.Context, client http.Client, relayAddress string) error
- type Manager
- func (m *Manager) AllPrimary() []database.Replica
- func (m *Manager) Close() error
- func (m *Manager) ID() uuid.UUID
- func (m *Manager) InRegion(regionID int32) []database.Replica
- func (m *Manager) PublishUpdate() error
- func (m *Manager) Regional() []database.Replica
- func (m *Manager) Self() database.Replica
- func (m *Manager) SetCallback(callback func())
- func (m *Manager) UpdateNow(ctx context.Context) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var PubsubEvent = "replica"
Functions ¶
func CreateDERPMeshTLSConfig ¶ added in v2.8.5
func CreateDERPMeshTLSConfig(hostname string, tlsCertificates []tls.Certificate) (*tls.Config, error)
CreateDERPMeshTLSConfig creates a TLS configuration for connecting to peers in the DERP mesh over private networking. It overrides the ServerName to be the expected public hostname of the peer, and trusts all of the TLS server certificates used by this replica (as we expect all replicas to use the same TLS certificates).
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager keeps the replica up to date and in sync with other replicas.
func New ¶
func New(ctx context.Context, logger slog.Logger, db database.Store, ps pubsub.Pubsub, options *Options) (*Manager, error)
New registers the replica with the database and periodically updates to ensure it's healthy. It contacts all other alive replicas to ensure they are reachable.
func (*Manager) AllPrimary ¶
AllPrimary returns every primary replica (not workspace proxy replicas), including itself.
func (*Manager) InRegion ¶
InRegion returns every replica in the given DERP region excluding itself.
func (*Manager) PublishUpdate ¶
PublishUpdate notifies all other replicas to update.
func (*Manager) SetCallback ¶
func (m *Manager) SetCallback(callback func())
SetCallback sets a function to execute whenever new peers are refreshed or updated.