Skip to content

Commit

Permalink
Move source files out of plugin folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslorentz committed May 19, 2022
1 parent 2ac1042 commit e8df9c8
Show file tree
Hide file tree
Showing 63 changed files with 45 additions and 51 deletions.
2 changes: 0 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ set -e
echo ==PARAMETERS==
echo ARTIFACTS: "${ARTIFACTS:=./artifacts}"

cd plugin
go vet ./...
go test -race ./...
cd ../

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
caddy = *.example.com
caddy.1_@foo = host foo.example.com
caddy.1_handle = @foo
caddy.1_handle.reverse_proxy = foo:8080
caddy = *.example.com
caddy.2_@bar = host bar.example.com
caddy.2_handle = @bar
caddy.2_handle.reverse_proxy = bar:8080
----------
*.example.com {
@foo host foo.example.com
@bar host bar.example.com
handle @foo {
reverse_proxy foo:8080
}
handle @bar {
reverse_proxy bar:8080
}
caddy = *.example.com
caddy.1_@foo = host foo.example.com
caddy.1_handle = @foo
caddy.1_handle.reverse_proxy = foo:8080

caddy = *.example.com
caddy.2_@bar = host bar.example.com
caddy.2_handle = @bar
caddy.2_handle.reverse_proxy = bar:8080
----------
*.example.com {
@foo host foo.example.com
@bar host bar.example.com
handle @foo {
reverse_proxy foo:8080
}
handle @bar {
reverse_proxy bar:8080
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions plugin/cmd.go → cmd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package plugin
package caddydockerproxy

import (
"flag"
Expand All @@ -10,8 +10,8 @@ import (

"github.com/caddyserver/caddy/v2"
caddycmd "github.com/caddyserver/caddy/v2/cmd"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/generator"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/generator"

"go.uber.org/zap"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion plugin/generator/containers.go → generator/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package generator

import (
"github.com/docker/docker/api/types"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/caddyfile"
"github.com/lucaslorentz/caddy-docker-proxy/v2/caddyfile"
"go.uber.org/zap"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
)

func TestContainers_TemplateData(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions plugin/generator/generator.go → generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/caddyfile"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/docker"
"github.com/lucaslorentz/caddy-docker-proxy/v2/caddyfile"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/docker"

"go.uber.org/zap"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/swarm"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/docker"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/docker"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down
2 changes: 1 addition & 1 deletion plugin/generator/labels.go → generator/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"text/template"

"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/caddyfile"
"github.com/lucaslorentz/caddy-docker-proxy/v2/caddyfile"
)

type targetsProvider func() ([]string, error)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion plugin/generator/services.go → generator/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/caddyfile"
"github.com/lucaslorentz/caddy-docker-proxy/v2/caddyfile"

"go.uber.org/zap"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
)

func TestServices_TemplateData(t *testing.T) {
Expand Down
File renamed without changes.
17 changes: 9 additions & 8 deletions plugin/loader.go → loader.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package plugin
package caddydockerproxy

import (
"bytes"
Expand All @@ -17,9 +17,10 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/docker"
"github.com/lucaslorentz/caddy-docker-proxy/v2/plugin/generator"
"github.com/lucaslorentz/caddy-docker-proxy/v2/config"
"github.com/lucaslorentz/caddy-docker-proxy/v2/docker"
"github.com/lucaslorentz/caddy-docker-proxy/v2/generator"
"github.com/lucaslorentz/caddy-docker-proxy/v2/utils"

"go.uber.org/zap"
)
Expand All @@ -35,16 +36,16 @@ type DockerLoader struct {
lastCaddyfile []byte
lastJSONConfig []byte
lastVersion int64
serversVersions *StringInt64CMap
serversUpdating *StringBoolCMap
serversVersions *utils.StringInt64CMap
serversUpdating *utils.StringBoolCMap
}

// CreateDockerLoader creates a docker loader
func CreateDockerLoader(options *config.Options) *DockerLoader {
return &DockerLoader{
options: options,
serversVersions: newStringInt64CMap(),
serversUpdating: newStringBoolCMap(),
serversVersions: utils.NewStringInt64CMap(),
serversUpdating: utils.NewStringBoolCMap(),
}
}

Expand Down
5 changes: 0 additions & 5 deletions main.go

This file was deleted.

4 changes: 2 additions & 2 deletions plugin/stringBoolCMap.go → utils/stringBoolCMap.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package plugin
package utils

import (
"sync"
Expand All @@ -10,7 +10,7 @@ type StringBoolCMap struct {
internal map[string]bool
}

func newStringBoolCMap() *StringBoolCMap {
func NewStringBoolCMap() *StringBoolCMap {
return &StringBoolCMap{
mutex: sync.RWMutex{},
internal: map[string]bool{},
Expand Down
4 changes: 2 additions & 2 deletions plugin/stringInt64CMap.go → utils/stringInt64CMap.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package plugin
package utils

import (
"sync"
Expand All @@ -10,7 +10,7 @@ type StringInt64CMap struct {
internal map[string]int64
}

func newStringInt64CMap() *StringInt64CMap {
func NewStringInt64CMap() *StringInt64CMap {
return &StringInt64CMap{
mutex: sync.RWMutex{},
internal: map[string]int64{},
Expand Down

0 comments on commit e8df9c8

Please sign in to comment.