-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from darkweak/feat/middleware/traefik-support
feat(middleware): Support Traefik and bump version
- Loading branch information
Showing
25 changed files
with
644 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
displayName: ESI | ||
type: middleware | ||
import: github.com/darkweak/go-esi/middleware/traefik | ||
summary: 'Pure implementation of the ESI process' | ||
|
||
testData: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: '3.8' | ||
|
||
services: | ||
traefik: | ||
image: traefik:latest | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- ../..:/plugins-local/src/github.com/darkweak/go-esi | ||
- ./traefik.yml:/traefik.yml | ||
- ./esi-configuration.yml:/esi-configuration.yml | ||
environment: | ||
GOPATH: /plugins-local | ||
ports: | ||
- 80:80 | ||
- 8080:8080 | ||
|
||
whoami: | ||
image: traefik/whoami | ||
labels: | ||
- traefik.http.routers.whoami.rule=Host(`domain.com`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
http: | ||
routers: | ||
whoami: | ||
middlewares: | ||
- esi | ||
entrypoints: | ||
- http | ||
service: whoami | ||
rule: Host(`domain.com`) | ||
|
||
services: | ||
whoami: | ||
loadBalancer: | ||
servers: | ||
- url: http://whoami | ||
passHostHeader: false | ||
|
||
middlewares: | ||
esi: | ||
plugin: | ||
esi: | ||
# We don't care about the configuration but we have ot declare that block | ||
# due to shitty træfik empty configuration handle. | ||
disable: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package traefik | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
|
||
"github.com/darkweak/go-esi/esi" | ||
) | ||
|
||
// Config the plugin configuration. | ||
type Config struct{} | ||
|
||
// CreateConfig creates the default plugin configuration. | ||
func CreateConfig() *Config { | ||
return &Config{} | ||
} | ||
|
||
// Demo a Demo plugin. | ||
type Demo struct { | ||
next http.Handler | ||
name string | ||
} | ||
|
||
// New created a new Demo plugin. | ||
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) { | ||
return &Demo{ | ||
next: next, | ||
name: name, | ||
}, nil | ||
} | ||
|
||
func (a *Demo) ServeHTTP(rw http.ResponseWriter, req *http.Request) { | ||
esi.Parse([]byte{}, req) | ||
a.next.ServeHTTP(rw, req) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module github.com/darkweak/go-esi/middleware/traefik | ||
|
||
go 1.18 | ||
|
||
require github.com/darkweak/go-esi v0.0.4 | ||
|
||
replace github.com/darkweak/go-esi v0.0.4 => ../.. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
providers: | ||
file: | ||
filename: /esi-configuration.yml | ||
watch: true | ||
|
||
api: | ||
dashboard: true | ||
debug: true | ||
insecure: true | ||
|
||
pilot: | ||
token: 12926953-a7d1-4223-a092-d7dd95a91fa3 | ||
|
||
experimental: | ||
localPlugins: | ||
esi: | ||
moduleName: github.com/darkweak/go-esi | ||
|
||
log: | ||
level: DEBUG | ||
|
||
accessLog: {} |
21 changes: 21 additions & 0 deletions
21
middleware/traefik/vendor/github.com/darkweak/go-esi/LICENSE
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
middleware/traefik/vendor/github.com/darkweak/go-esi/esi/choose.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
middleware/traefik/vendor/github.com/darkweak/go-esi/esi/comment.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
middleware/traefik/vendor/github.com/darkweak/go-esi/esi/errors.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
middleware/traefik/vendor/github.com/darkweak/go-esi/esi/escape.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.