urlmap

package
v0.0.0-...-d5c79cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DomainFilters = map[string]func(*url.URL) bool{
	"twitter.com":   isLinkToTweet,
	"x.com":         isLinkToTweet,
	"tiktok.com":    isLinkToTikTokPost,
	"instagram.com": isLinkToInstagramPost,
	"reddit.com":    isLinkToRedditPost,
}

DomainFilters is a mapping of domain names to filters for said domain name

View Source
var DomainReplacements = map[string]string{
	"twitter.com":   "fxtwitter.com",
	"x.com":         "fxtwitter.com",
	"tiktok.com":    "tiktxk.com",
	"instagram.com": "ddinstagram.com",
	"reddit.com":    "rxddit.com",
}

DomainReplacements is a mapping of domain names to their replacements

Functions

func MapURLs

func MapURLs(domainReplacements map[string]string, filters map[string]func(*url.URL) bool, urls []string) []string

MapURLs maps the URLs according to the replacement and filter rules. Returns the replacement URLs.

  • `domainReplacements` is a map of domains and their replacements
  • `filters` map of domains to a filter function to filter out only certain requests. The function takes a URL (post-mapping, ie "https://fxtwitter.example/...") and returns true if the URL should be replaced.

Types

type TiktxkResponse

type TiktxkResponse struct {
	Success bool `json:"success"`
}

TiktxkResponse is a struct which describes the success state of a tiktxk response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL