Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultDuration = 10 * time.Second DefaultSchema = "http" )
Functions ¶
This section is empty.
Types ¶
type DNSPath ¶
type DNSPath struct {
Paths []*Path `cfg:"paths"`
}
DNSPath is a middleware that replaces the path of the request with hostname to IP address.
- http://proxy/metrics/kafka/1/metrics -> http://10.0.0.1/metrics
- http://proxy/metrics/kafka/2/metrics -> http://10.0.0.2/metrics
func (*DNSPath) ForwardRequest ¶
func (m *DNSPath) ForwardRequest(w http.ResponseWriter, r *http.Request, target *url.URL, transport http.RoundTripper)
func (*DNSPath) Middleware ¶
func (*DNSPath) ReplaceRequest ¶
type IPHolder ¶
type IPHolder struct {
// contains filtered or unexported fields
}
func NewIPHolder ¶
func NewIPHolder() *IPHolder
type Path ¶
type Path struct { DNS string `cfg:"dns"` // Regex to match the path // Example: /metrics/kafka/(\d+)/(.*) Regex string `cfg:"regex"` // Number to extract in regex // Example: $1 Number string `cfg:"number"` Replacement string `cfg:"replacement"` Schema string `cfg:"schema"` Port string `cfg:"port"` InsecureSkipVerify bool `cfg:"insecure_skip_verify"` Duration time.Duration `cfg:"duration"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.