code review

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
Mohammed Al Sahaf 2025-03-14 04:42:57 +03:00
parent c54f5019dc
commit a4f811e14f
No known key found for this signature in database
4 changed files with 12 additions and 15 deletions
modules.go
modules
caddytls
internal/network
network.go

View file

@ -18,6 +18,8 @@ import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/url"
"reflect"
"sort"
"strings"
@ -360,6 +362,14 @@ func isModuleMapType(typ reflect.Type) bool {
isJSONRawMessage(typ.Elem())
}
// ProxyFuncProducer is implemented by modules which produce a
// function that returns a URL to use as network proxy. Modules
// in the namespace `caddy.network_proxy.source` must implement this
// interface.
type ProxyFuncProducer interface {
ProxyFunc() func(*http.Request) (*url.URL, error)
}
var (
modules = make(map[string]ModuleInfo)
modulesMu sync.RWMutex

View file

@ -1,3 +0,0 @@
package caddytls
import _ "github.com/caddyserver/caddy/v2/modules/internal/network"

View file

@ -133,10 +133,10 @@ func (p ProxyFromNone) ProxyFunc() func(*http.Request) (*url.URL, error) {
var (
_ caddy.Module = ProxyFromURL{}
_ caddy.Provisioner = &ProxyFromURL{}
_ caddy.Provisioner = (*ProxyFromURL)(nil)
_ caddy.Validator = ProxyFromURL{}
_ caddy.ProxyFuncProducer = ProxyFromURL{}
_ caddyfile.Unmarshaler = &ProxyFromURL{}
_ caddyfile.Unmarshaler = (*ProxyFromURL)(nil)
_ caddy.Module = ProxyFromNone{}
_ caddy.ProxyFuncProducer = ProxyFromNone{}

View file

@ -1,10 +0,0 @@
package caddy
import (
"net/http"
"net/url"
)
type ProxyFuncProducer interface {
ProxyFunc() func(*http.Request) (*url.URL, error)
}