Skip to content

Commit

Permalink
Merge remove docker routing
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby authored Jun 13, 2022
2 parents bbb8ac5 + 687d292 commit 265a4ec
Show file tree
Hide file tree
Showing 329 changed files with 24 additions and 52,119 deletions.
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

21 changes: 0 additions & 21 deletions README_DEV.md

This file was deleted.

11 changes: 0 additions & 11 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/BurntSushi/toml"
"github.com/rekby/lets-proxy2/internal/config"
"github.com/rekby/lets-proxy2/internal/docker"
"github.com/rekby/lets-proxy2/internal/domain_checker"
"github.com/rekby/lets-proxy2/internal/log"
"github.com/rekby/lets-proxy2/internal/profiler"
Expand All @@ -33,17 +32,10 @@ type configType struct {
CheckDomains domain_checker.Config
Listen tlslistener.Config

DockerRouter configDocker

Profiler profiler.Config
Metrics config.Config
}

type configDocker struct {
Enable bool
docker.Config
}

type configGeneral struct {
IssueTimeout int
StorageDir string
Expand Down Expand Up @@ -93,9 +85,6 @@ func getConfig(ctx context.Context) *configType {
if *debugLog {
_config.Log.LogLevel = "debug"
}
if *enableDockerRouter {
_config.DockerRouter.Enable = true
}
}
return _config
}
Expand Down
13 changes: 6 additions & 7 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package main
import "flag"

var (
configFileP = flag.String("config", "config.tom[l]", "Path to config file. Internally expand glob syntax.")
debugLog = flag.Bool("debug", false, "Enable debug logging")
enableDockerRouter = flag.Bool("enable-docker-router", false, "")
defaultConfigP = flag.Bool("print-default-config", false, "Write default config to stdout and exit.")
versionP = flag.Bool("version", false, "print version and exit")
testAcmeServerP = flag.Bool("test-acme-server", false, "Use test acme server, instead address from config")
manualAcmeServer = flag.String("acme-server", "", "Override acme server")
configFileP = flag.String("config", "config.tom[l]", "Path to config file. Internally expand glob syntax.")
debugLog = flag.Bool("debug", false, "Enable debug logging")
defaultConfigP = flag.Bool("print-default-config", false, "Write default config to stdout and exit.")
versionP = flag.Bool("version", false, "print version and exit")
testAcmeServerP = flag.Bool("test-acme-server", false, "Use test acme server, instead address from config")
manualAcmeServer = flag.String("acme-server", "", "Override acme server")
)
12 changes: 2 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"strings"
"time"

"github.com/rekby/lets-proxy2/internal/docker"

"golang.org/x/xerrors"

"github.com/rekby/lets-proxy2/internal/config"
Expand Down Expand Up @@ -143,13 +141,7 @@ func startProgram(config *configType) {
certManager.AutoSubdomains = append(certManager.AutoSubdomains, subdomain)
}

var dockerClient docker.Interface
if config.DockerRouter.Enable {
dockerClient, err = docker.New(config.DockerRouter.Config)
log.InfoFatal(logger, err, "Enable docker router")
}

certManager.DomainChecker, err = config.CheckDomains.CreateDomainChecker(ctx, dockerClient)
certManager.DomainChecker, err = config.CheckDomains.CreateDomainChecker(ctx)
log.DebugFatal(logger, err, "Config domain checkers.")

err = startMetrics(ctx, registry, config.Metrics, certManager.GetCertificate)
Expand All @@ -172,7 +164,7 @@ func startProgram(config *configType) {
return tlsListener.GetConnectionContext(req.RemoteAddr, localAddr.String())
}

err = config.Proxy.Apply(ctx, p, dockerClient)
err = config.Proxy.Apply(ctx, p)
log.InfoFatal(logger, err, "Apply proxy config")

go func() {
Expand Down
9 changes: 0 additions & 9 deletions cmd/static/default-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,6 @@ TLSAddresses = [":443"]
# Bind addresses without TLS secure (for HTTP reverse proxy and http-01 validation without redirect to https)
TCPAddresses = []

[DockerRouter]
# Default docker
Enable = false

# Port of target docker container
DefaultHttpPort = 80

LabelDomain = "lets-proxy.domain"

[Metrics]
# Enable metrics in prometheous formath by http.
Enable = false
Expand Down
11 changes: 0 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.18
require (
github.com/BurntSushi/toml v1.1.0
github.com/aws/aws-sdk-go v1.44.32
github.com/docker/docker v20.10.17+incompatible // need old version for compatible with go1.10
github.com/gojuno/minimock/v3 v3.0.5
github.com/kardianos/minwinsvc v1.0.0
github.com/maxatome/go-testdeep v1.1.0
Expand All @@ -27,23 +26,14 @@ require (
require github.com/letsencrypt/pebble/v2 v2.4.0

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/letsencrypt/challtestsrv v1.2.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
Expand All @@ -55,5 +45,4 @@ require (
golang.org/x/tools v0.1.11 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gotest.tools/v3 v3.2.0 // indirect
)
Loading

0 comments on commit 265a4ec

Please sign in to comment.