app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexedRedirects added in v0.1.8

type IndexedRedirects struct {
	LengthMap   map[int]map[string][]*Rule
	DomainRules []*Rule
	// contains filtered or unexported fields
}

func NewIndexedRedirects added in v0.1.8

func NewIndexedRedirects() *IndexedRedirects

func (*IndexedRedirects) Delete added in v0.1.8

func (idx *IndexedRedirects) Delete(pattern, fromDomain string)

func (*IndexedRedirects) IndexRule added in v0.1.8

func (idx *IndexedRedirects) IndexRule(pattern, fromDomain, target string)

func (*IndexedRedirects) Match added in v0.1.8

func (idx *IndexedRedirects) Match(url string) (string, bool)

Match matches the incoming requests against the redirect rules

func (*IndexedRedirects) Update added in v0.1.8

func (idx *IndexedRedirects) Update(pattern, fromDomain, target string)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(fileName string, gqlClient *v1.GraphQLClient) *Logger

func (*Logger) LoadLoggedRequests

func (l *Logger) LoadLoggedRequests() error

LoadLoggedRequests loads the requestsMap with data from the .log file

func (*Logger) LogRequest

func (l *Logger) LogRequest(requestURL string) error

LogRequest logs any incoming requests with dates to the .log file

func (*Logger) SendLogs

func (l *Logger) SendLogs()

func (*Logger) SendLogsWeekly

func (l *Logger) SendLogsWeekly()

SendLogsWeekly starts a cron job to send request logs weekly

type RedirectManager

type RedirectManager struct {
	IndexedRedirects *IndexedRedirects
	// contains filtered or unexported fields
}

func NewRedirectManager

func NewRedirectManager(db *sql.DB, gqlClient *api.GraphQLClient) *RedirectManager

func (*RedirectManager) DeleteOldRedirect

func (rm *RedirectManager) DeleteOldRedirect(id string) error

func (*RedirectManager) FetchRedirectsOverChannel

func (rm *RedirectManager) FetchRedirectsOverChannel(redirectsCh chan<- []api.Redirect, errCh chan<- error)

func (*RedirectManager) HandleNewOrUpdatedRedirects

func (rm *RedirectManager) HandleNewOrUpdatedRedirects(fetchedRedirects *[]api.Redirect)

func (*RedirectManager) HandleOldRedirectsDeletion

func (rm *RedirectManager) HandleOldRedirectsDeletion(fetchedRedirects *[]api.Redirect)

func (*RedirectManager) PopulateMapsWithDataFromDB added in v0.1.9

func (rm *RedirectManager) PopulateMapsWithDataFromDB()

func (*RedirectManager) SyncRedirects

func (rm *RedirectManager) SyncRedirects(redirectsCh <-chan []api.Redirect, errCh <-chan error)

SyncRedirects synchronizes the fetched redirects with the redirects map and the sqlite records

func (*RedirectManager) UpsertRedirect

func (rm *RedirectManager) UpsertRedirect(r api.Redirect) error

type Rule added in v0.1.8

type Rule struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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