-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
96 lines (82 loc) · 2.58 KB
/
Copy pathtypes.go
File metadata and controls
96 lines (82 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package main
import (
"io"
"net/http"
"net/url"
"sync"
)
type backendURL struct {
URL *url.URL
Options BackendRefOptions
}
type BackendRef struct {
IP string `mapstructure:"ip"`
Port int `mapstructure:"port"`
Protocol string `mapstructure:"protocol"`
TLS TLS `mapstructure:"tls"`
Options BackendRefOptions `mapstructure:"options"`
}
type BackendRefOptions struct {
InsecureSkipVerify bool `mapstructure:"insecureSkipVerify"`
}
type Rule struct {
BackendRefs []BackendRef `mapstructure:"backendRefs"`
InsecureSkipVerify bool `mapstructure:"insecureSkipVerify"`
}
type Limit struct {
Requests int `mapstructure:"requests"`
Every int `mapstructure:"every"`
}
type Path struct {
Path string `mapstructure:"path"`
PathType string `mapstructure:"type"`
Limit Limit `mapstructure:"limit"`
}
type Route struct {
Name string `mapstructure:"name"`
Lb string `mapstructure:"lb"`
Hostnames []string `mapstructure:"hostnames"`
Paths []Path `mapstructure:"paths"`
Rules []Rule `mapstructure:"rules"`
}
type TLS struct {
Cert string `mapstructure:"cert"`
Key string `mapstructure:"key"`
}
type Bug struct {
Debug bool `mapstructure:"debug"`
Ip string `mapstructure:"ip"`
Port int `mapstructure:"port"`
Protocol string `mapstructure:"protocol"`
Lb string `mapstructure:"lb"`
Tls TLS `mapstructure:"tls"`
Limit Limit `mapstructure:"limit"`
}
// Listen defines the bind address for a TCP/UDP stream proxy
type Listen struct {
Ip string `mapstructure:"ip"`
Port int `mapstructure:"port"`
}
// Stream defines a raw TCP/UDP forwarding stream with optional load balancing
// The structure intentionally mirrors HTTP routes where possible to preserve
// configuration consistency across protocols.
type Stream struct {
Name string `mapstructure:"name"`
Protocol string `mapstructure:"protocol"` // acceptable values: tcp, udp
Lb string `mapstructure:"lb"`
Listen Listen `mapstructure:"listen"`
Rules []Rule `mapstructure:"rules"`
}
type Config struct {
Version int `mapstructure:"version"`
Bug Bug `mapstructure:"bug"`
Routes []Route `mapstructure:"routes"`
Streams []Stream `mapstructure:"streams"`
}
type App struct {
handler http.Handler
config *Config
mu sync.RWMutex
// streamClosers hold running TCP/UDP stream servers which must be closed on reload
streamClosers []io.Closer
}