package urls import ( "fmt" "net/url" "path" ) func UrlInbox(name, domain string) (*url.URL, error) { u, err := url.Parse(path.Join(domain, "actors", name, "inbox")) u.Scheme = "https" if err != nil { return nil, fmt.Errorf("could not build inbox url: %w", err) } return u, nil } func UrlOutbox(name, domain string) (*url.URL, error) { u, err := url.Parse(path.Join(domain, "actors", name, "outbox")) u.Scheme = "https" if err != nil { return nil, fmt.Errorf("could not build outbox url: %w", err) } return u, nil } func UrlActivity(name, domain, id string) (*url.URL, error) { u, err := url.Parse(path.Join(domain, "actors", name, "activity", id)) u.Scheme = "https" if err != nil { return nil, fmt.Errorf("could not build activity url: %w", err) } return u, nil } func UrlNote(name, domain, id string) (*url.URL, error) { u, err := url.Parse(path.Join(domain, "actors", name, "activity", id, "note")) u.Scheme = "https" if err != nil { return nil, fmt.Errorf("could not build note url: %w", err) } return u, nil } func UrlOutboxPage(name, domain string) (*url.URL, error) { u, err := UrlOutbox(name, domain) u.Scheme = "https" if err != nil { return nil, fmt.Errorf("could not build outbox page url: %w", err) } q := u.Query() q.Set("page", "true") u.RawQuery = q.Encode() return u, nil }