Files
ultrashorty/internal/redirect.go
T
2026-03-30 21:42:52 +01:00

25 lines
368 B
Go

package internal
type Redirect struct {
From string
To string
StatusCode int
}
func (r *Redirect) Match(from string) bool {
return from == r.From
}
type Redirects []*Redirect
func (rs Redirects) Find(from string) *Redirect {
for i := 0; i < len(rs); i++ {
redirect := rs[i]
if redirect.Match(from) {
return redirect
}
}
return nil
}