X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/723f6e18adc6482ed913e1618c8a76e981720c2b..f5c601f1801aaa276f8c335fcb51c373edc0b50c:/routes.go diff --git a/routes.go b/routes.go index 7dce691..02e28e2 100644 --- a/routes.go +++ b/routes.go @@ -13,6 +13,16 @@ import ( "go.mau.fi/whatsmeow/types" ) +// Routes owns the root's source map. Writes replace the private file before +// changing the map in memory. The mutex protects reads and writes from tools +// and status commands. Logs omit source IDs, which can hold phone numbers. +type Routes struct { + mutex sync.Mutex + path string + logger *slog.Logger + targets map[string]string +} + // openRoutes reads the source-to-child map. A missing file has no routes. func openRoutes(path string, logger *slog.Logger) (*Routes, error) { r := &Routes{ @@ -52,16 +62,6 @@ func openRoutes(path string, logger *slog.Logger) (*Routes, error) { return r, nil } -// Routes owns the root's source map. Writes replace the private file before -// changing the map in memory. The mutex protects reads and writes from tools -// and status commands. Logs omit source IDs, which can hold phone numbers. -type Routes struct { - mutex sync.Mutex - path string - logger *slog.Logger - targets map[string]string -} - // Set maps source to a child name, or removes it when target is empty. The // caller checks that a nonempty target is a child of the root. func (r *Routes) Set(source, target string) error {