ipn_clone.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
  4. package ipn
  5. import (
  6. "net/netip"
  7. "tailscale.com/tailcfg"
  8. "tailscale.com/types/persist"
  9. "tailscale.com/types/preftype"
  10. )
  11. // Clone makes a deep copy of Prefs.
  12. // The result aliases no memory with the original.
  13. func (src *Prefs) Clone() *Prefs {
  14. if src == nil {
  15. return nil
  16. }
  17. dst := new(Prefs)
  18. *dst = *src
  19. dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
  20. dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
  21. dst.Persist = src.Persist.Clone()
  22. return dst
  23. }
  24. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  25. var _PrefsCloneNeedsRegeneration = Prefs(struct {
  26. ControlURL string
  27. RouteAll bool
  28. AllowSingleHosts bool
  29. ExitNodeID tailcfg.StableNodeID
  30. ExitNodeIP netip.Addr
  31. ExitNodeAllowLANAccess bool
  32. CorpDNS bool
  33. RunSSH bool
  34. WantRunning bool
  35. LoggedOut bool
  36. ShieldsUp bool
  37. AdvertiseTags []string
  38. Hostname string
  39. NotepadURLs bool
  40. ForceDaemon bool
  41. Egg bool
  42. AdvertiseRoutes []netip.Prefix
  43. NoSNAT bool
  44. NetfilterMode preftype.NetfilterMode
  45. OperatorUser string
  46. ProfileName string
  47. Persist *persist.Persist
  48. }{})
  49. // Clone makes a deep copy of ServeConfig.
  50. // The result aliases no memory with the original.
  51. func (src *ServeConfig) Clone() *ServeConfig {
  52. if src == nil {
  53. return nil
  54. }
  55. dst := new(ServeConfig)
  56. *dst = *src
  57. if dst.TCP != nil {
  58. dst.TCP = map[uint16]*TCPPortHandler{}
  59. for k, v := range src.TCP {
  60. dst.TCP[k] = v.Clone()
  61. }
  62. }
  63. if dst.Web != nil {
  64. dst.Web = map[HostPort]*WebServerConfig{}
  65. for k, v := range src.Web {
  66. dst.Web[k] = v.Clone()
  67. }
  68. }
  69. if dst.AllowFunnel != nil {
  70. dst.AllowFunnel = map[HostPort]bool{}
  71. for k, v := range src.AllowFunnel {
  72. dst.AllowFunnel[k] = v
  73. }
  74. }
  75. return dst
  76. }
  77. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  78. var _ServeConfigCloneNeedsRegeneration = ServeConfig(struct {
  79. TCP map[uint16]*TCPPortHandler
  80. Web map[HostPort]*WebServerConfig
  81. AllowFunnel map[HostPort]bool
  82. }{})
  83. // Clone makes a deep copy of TCPPortHandler.
  84. // The result aliases no memory with the original.
  85. func (src *TCPPortHandler) Clone() *TCPPortHandler {
  86. if src == nil {
  87. return nil
  88. }
  89. dst := new(TCPPortHandler)
  90. *dst = *src
  91. return dst
  92. }
  93. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  94. var _TCPPortHandlerCloneNeedsRegeneration = TCPPortHandler(struct {
  95. HTTPS bool
  96. HTTP bool
  97. TCPForward string
  98. TerminateTLS string
  99. }{})
  100. // Clone makes a deep copy of HTTPHandler.
  101. // The result aliases no memory with the original.
  102. func (src *HTTPHandler) Clone() *HTTPHandler {
  103. if src == nil {
  104. return nil
  105. }
  106. dst := new(HTTPHandler)
  107. *dst = *src
  108. return dst
  109. }
  110. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  111. var _HTTPHandlerCloneNeedsRegeneration = HTTPHandler(struct {
  112. Path string
  113. Proxy string
  114. Text string
  115. }{})
  116. // Clone makes a deep copy of WebServerConfig.
  117. // The result aliases no memory with the original.
  118. func (src *WebServerConfig) Clone() *WebServerConfig {
  119. if src == nil {
  120. return nil
  121. }
  122. dst := new(WebServerConfig)
  123. *dst = *src
  124. if dst.Handlers != nil {
  125. dst.Handlers = map[string]*HTTPHandler{}
  126. for k, v := range src.Handlers {
  127. dst.Handlers[k] = v.Clone()
  128. }
  129. }
  130. return dst
  131. }
  132. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  133. var _WebServerConfigCloneNeedsRegeneration = WebServerConfig(struct {
  134. Handlers map[string]*HTTPHandler
  135. }{})