mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-05 04:11:59 +00:00
ipn: add WebServerConfig, add views
cmd/viewer couldn't deal with that map-of-map. Add a wrapper type instead, which also gives us a place to add future stuff. Updates tailscale/corp#7515 Change-Id: I44a4ca1915300ea8678e5b0385056f0642ccb155 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
79472a4a6e
commit
df5e40f731
@@ -55,3 +55,89 @@ var _PrefsCloneNeedsRegeneration = Prefs(struct {
|
||||
OperatorUser string
|
||||
Persist *persist.Persist
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of ServeConfig.
|
||||
// The result aliases no memory with the original.
|
||||
func (src *ServeConfig) Clone() *ServeConfig {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
dst := new(ServeConfig)
|
||||
*dst = *src
|
||||
if dst.TCP != nil {
|
||||
dst.TCP = map[int]*TCPPortHandler{}
|
||||
for k, v := range src.TCP {
|
||||
dst.TCP[k] = v.Clone()
|
||||
}
|
||||
}
|
||||
if dst.Web != nil {
|
||||
dst.Web = map[HostPort]*WebServerConfig{}
|
||||
for k, v := range src.Web {
|
||||
dst.Web[k] = v.Clone()
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _ServeConfigCloneNeedsRegeneration = ServeConfig(struct {
|
||||
TCP map[int]*TCPPortHandler
|
||||
Web map[HostPort]*WebServerConfig
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of TCPPortHandler.
|
||||
// The result aliases no memory with the original.
|
||||
func (src *TCPPortHandler) Clone() *TCPPortHandler {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
dst := new(TCPPortHandler)
|
||||
*dst = *src
|
||||
return dst
|
||||
}
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _TCPPortHandlerCloneNeedsRegeneration = TCPPortHandler(struct {
|
||||
HTTPS bool
|
||||
TCPForward string
|
||||
TerminateTLS bool
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of HTTPHandler.
|
||||
// The result aliases no memory with the original.
|
||||
func (src *HTTPHandler) Clone() *HTTPHandler {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
dst := new(HTTPHandler)
|
||||
*dst = *src
|
||||
return dst
|
||||
}
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _HTTPHandlerCloneNeedsRegeneration = HTTPHandler(struct {
|
||||
Path string
|
||||
Proxy string
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of WebServerConfig.
|
||||
// The result aliases no memory with the original.
|
||||
func (src *WebServerConfig) Clone() *WebServerConfig {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
dst := new(WebServerConfig)
|
||||
*dst = *src
|
||||
if dst.Handlers != nil {
|
||||
dst.Handlers = map[string]*HTTPHandler{}
|
||||
for k, v := range src.Handlers {
|
||||
dst.Handlers[k] = v.Clone()
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _WebServerConfigCloneNeedsRegeneration = WebServerConfig(struct {
|
||||
Handlers map[string]*HTTPHandler
|
||||
}{})
|
||||
|
||||
Reference in New Issue
Block a user