1 Commits

Author SHA1 Message Date
Gianni Carafa
8b3551659f run make file in build job 2023-12-05 15:07:12 +01:00
4 changed files with 4 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ COPY . .
RUN go mod download RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o ladder cmd/main.go RUN make build
FROM debian:12-slim as release FROM debian:12-slim as release
@@ -18,8 +18,4 @@ RUN chmod +x /app/ladder
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
#EXPOSE 8080
#ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["sh", "-c", "/app/ladder"] CMD ["sh", "-c", "/app/ladder"]

View File

@@ -6,7 +6,7 @@
<div><img alt="License" src="https://img.shields.io/github/license/everywall/ladder"> <img alt="go.mod Go version " src="https://img.shields.io/github/go-mod/go-version/everywall/ladder"> <img alt="GitHub tag (with filter)" src="https://img.shields.io/github/v/tag/everywall/ladder"> <img alt="GitHub (Pre-)Release Date" src="https://img.shields.io/github/release-date-pre/everywall/ladder"> <img alt="GitHub Downloads all releases" src="https://img.shields.io/github/downloads/everywall/ladder/total"> <img alt="GitHub Build Status (with event)" src="https://img.shields.io/github/actions/workflow/status/everywall/ladder/release-binaries.yaml"></div> <div><img alt="License" src="https://img.shields.io/github/license/everywall/ladder"> <img alt="go.mod Go version " src="https://img.shields.io/github/go-mod/go-version/everywall/ladder"> <img alt="GitHub tag (with filter)" src="https://img.shields.io/github/v/tag/everywall/ladder"> <img alt="GitHub (Pre-)Release Date" src="https://img.shields.io/github/release-date-pre/everywall/ladder"> <img alt="GitHub Downloads all releases" src="https://img.shields.io/github/downloads/everywall/ladder/total"> <img alt="GitHub Build Status (with event)" src="https://img.shields.io/github/actions/workflow/status/everywall/ladder/release-binaries.yaml"></div>
*Ladder is a http web proxy.* This is a selfhosted version of [1ft.io](https://1ft.io) and [12ft.io](https://12ft.io). It is inspired by [13ft](https://github.com/wasi-master/13ft). *Ladder is a web proxy to help bypass paywalls.* This is a selfhosted version of [1ft.io](https://1ft.io) and [12ft.io](https://12ft.io). It is inspired by [13ft](https://github.com/wasi-master/13ft).
### Why ### Why

View File

@@ -3,7 +3,7 @@ services:
ladder: ladder:
image: ghcr.io/everywall/ladder:latest image: ghcr.io/everywall/ladder:latest
container_name: ladder container_name: ladder
#build: . build: .
#restart: always #restart: always
#command: sh -c ./ladder #command: sh -c ./ladder
environment: environment:

View File

@@ -8,9 +8,7 @@ import (
"net/url" "net/url"
"os" "os"
"regexp" "regexp"
"strconv"
"strings" "strings"
"time"
"ladder/pkg/ruleset" "ladder/pkg/ruleset"
@@ -23,7 +21,6 @@ var (
ForwardedFor = getenv("X_FORWARDED_FOR", "66.249.66.1") ForwardedFor = getenv("X_FORWARDED_FOR", "66.249.66.1")
rulesSet = ruleset.NewRulesetFromEnv() rulesSet = ruleset.NewRulesetFromEnv()
allowedDomains = []string{} allowedDomains = []string{}
defaultTimeout = 15 // in seconds
) )
func init() { func init() {
@@ -31,9 +28,6 @@ func init() {
if os.Getenv("ALLOWED_DOMAINS_RULESET") == "true" { if os.Getenv("ALLOWED_DOMAINS_RULESET") == "true" {
allowedDomains = append(allowedDomains, rulesSet.Domains()...) allowedDomains = append(allowedDomains, rulesSet.Domains()...)
} }
if timeoutStr := os.Getenv("HTTP_TIMEOUT"); timeoutStr != "" {
defaultTimeout, _ = strconv.Atoi(timeoutStr)
}
} }
// extracts a URL from the request ctx. If the URL in the request // extracts a URL from the request ctx. If the URL in the request
@@ -187,9 +181,7 @@ func fetchSite(urlpath string, queries map[string]string) (string, *http.Request
} }
// Fetch the site // Fetch the site
client := &http.Client{ client := &http.Client{}
Timeout: time.Second * time.Duration(defaultTimeout),
}
req, _ := http.NewRequest("GET", url, nil) req, _ := http.NewRequest("GET", url, nil)
if rule.Headers.UserAgent != "" { if rule.Headers.UserAgent != "" {