Compare commits
1 Commits
v0.0.11
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
797a33068d |
0
.github/pull_request_template.md
vendored
Normal file
0
.github/pull_request_template.md
vendored
Normal file
@@ -96,7 +96,7 @@ http://localhost:8080/ruleset
|
|||||||
| `LOG_URLS` | Log fetched URL's | `true` |
|
| `LOG_URLS` | Log fetched URL's | `true` |
|
||||||
| `DISABLE_FORM` | Disables URL Form Frontpage | `false` |
|
| `DISABLE_FORM` | Disables URL Form Frontpage | `false` |
|
||||||
| `FORM_PATH` | Path to custom Form HTML | `` |
|
| `FORM_PATH` | Path to custom Form HTML | `` |
|
||||||
| `RULESET` | URL to a ruleset file | `https://raw.githubusercontent.com/kubero-dev/ladder/main/ruleset.yaml` or `/path/to/my/rules.yaml` |
|
| `RULESET` | URL to a ruleset file | `https://raw.githubusercontent.com/kubero-dev/ladder/main/ruleset.yaml` or `/path/to/my/rules.yaml` or `default` |
|
||||||
| `EXPOSE_RULESET` | Make your Ruleset available to other ladders | `true` |
|
| `EXPOSE_RULESET` | Make your Ruleset available to other ladders | `true` |
|
||||||
| `ALLOWED_DOMAINS` | Comma separated list of allowed domains. Empty = no limitations | `` |
|
| `ALLOWED_DOMAINS` | Comma separated list of allowed domains. Empty = no limitations | `` |
|
||||||
| `ALLOWED_DOMAINS_RULESET` | Allow Domains from Ruleset. false = no limitations | `false` |
|
| `ALLOWED_DOMAINS_RULESET` | Allow Domains from Ruleset. false = no limitations | `false` |
|
||||||
|
|||||||
@@ -33,12 +33,19 @@ func main() {
|
|||||||
Help: "Port the webserver will listen on"})
|
Help: "Port the webserver will listen on"})
|
||||||
|
|
||||||
pf, _ := strconv.ParseBool(os.Getenv("PREFORK"))
|
pf, _ := strconv.ParseBool(os.Getenv("PREFORK"))
|
||||||
|
|
||||||
prefork := parser.Flag("P", "prefork", &argparse.Options{
|
prefork := parser.Flag("P", "prefork", &argparse.Options{
|
||||||
Required: false,
|
Required: false,
|
||||||
Default: pf,
|
Default: pf,
|
||||||
Help: "This will spawn multiple processes listening"})
|
Help: "This will spawn multiple processes listening"})
|
||||||
|
|
||||||
|
r := os.Getenv("RULESET")
|
||||||
|
ruleset := parser.String("r", "ruleset", &argparse.Options{
|
||||||
|
Required: false,
|
||||||
|
Default: r,
|
||||||
|
Help: "Path or URL to your ruleset"})
|
||||||
|
|
||||||
|
handlers.LoadRules(*ruleset)
|
||||||
|
|
||||||
err := parser.Parse(os.Args)
|
err := parser.Parse(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Print(parser.Usage(err))
|
fmt.Print(parser.Usage(err))
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ import (
|
|||||||
|
|
||||||
var UserAgent = getenv("USER_AGENT", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)")
|
var UserAgent = getenv("USER_AGENT", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)")
|
||||||
var ForwardedFor = getenv("X_FORWARDED_FOR", "66.249.66.1")
|
var ForwardedFor = getenv("X_FORWARDED_FOR", "66.249.66.1")
|
||||||
var rulesSet = loadRules()
|
var rulesSet RuleSet
|
||||||
|
|
||||||
|
// var rulesSet = loadRules()
|
||||||
var allowedDomains = strings.Split(os.Getenv("ALLOWED_DOMAINS"), ",")
|
var allowedDomains = strings.Split(os.Getenv("ALLOWED_DOMAINS"), ",")
|
||||||
|
var Aaaa = "aaaa"
|
||||||
|
|
||||||
func ProxySite(c *fiber.Ctx) error {
|
func ProxySite(c *fiber.Ctx) error {
|
||||||
// Get the url from the URL
|
// Get the url from the URL
|
||||||
@@ -117,13 +120,18 @@ func getenv(key, fallback string) string {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadRules() RuleSet {
|
func LoadRules(rulesUrl string) RuleSet {
|
||||||
rulesUrl := os.Getenv("RULESET")
|
//rulesUrl := os.Getenv("RULESET")
|
||||||
if rulesUrl == "" {
|
if rulesUrl == "" {
|
||||||
RulesList := RuleSet{}
|
RulesList := RuleSet{}
|
||||||
return RulesList
|
return RulesList
|
||||||
}
|
}
|
||||||
log.Println("Loading rules")
|
|
||||||
|
if rulesUrl == "default" {
|
||||||
|
rulesUrl = "https://raw.githubusercontent.com/kubero-dev/ladder/main/ruleset.yaml"
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("Loading rules: " + rulesUrl)
|
||||||
|
|
||||||
var ruleSet RuleSet
|
var ruleSet RuleSet
|
||||||
if strings.HasPrefix(rulesUrl, "http") {
|
if strings.HasPrefix(rulesUrl, "http") {
|
||||||
|
|||||||
Reference in New Issue
Block a user