ipn_clone.go 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. "maps"
  7. "net/netip"
  8. "tailscale.com/drive"
  9. "tailscale.com/tailcfg"
  10. "tailscale.com/types/opt"
  11. "tailscale.com/types/persist"
  12. "tailscale.com/types/preftype"
  13. "tailscale.com/types/ptr"
  14. )
  15. // Clone makes a deep copy of LoginProfile.
  16. // The result aliases no memory with the original.
  17. func (src *LoginProfile) Clone() *LoginProfile {
  18. if src == nil {
  19. return nil
  20. }
  21. dst := new(LoginProfile)
  22. *dst = *src
  23. return dst
  24. }
  25. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  26. var _LoginProfileCloneNeedsRegeneration = LoginProfile(struct {
  27. ID ProfileID
  28. Name string
  29. NetworkProfile NetworkProfile
  30. Key StateKey
  31. UserProfile tailcfg.UserProfile
  32. NodeID tailcfg.StableNodeID
  33. LocalUserID WindowsUserID
  34. ControlURL string
  35. }{})
  36. // Clone makes a deep copy of Prefs.
  37. // The result aliases no memory with the original.
  38. func (src *Prefs) Clone() *Prefs {
  39. if src == nil {
  40. return nil
  41. }
  42. dst := new(Prefs)
  43. *dst = *src
  44. dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
  45. dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
  46. dst.AdvertiseServices = append(src.AdvertiseServices[:0:0], src.AdvertiseServices...)
  47. if src.DriveShares != nil {
  48. dst.DriveShares = make([]*drive.Share, len(src.DriveShares))
  49. for i := range dst.DriveShares {
  50. if src.DriveShares[i] == nil {
  51. dst.DriveShares[i] = nil
  52. } else {
  53. dst.DriveShares[i] = src.DriveShares[i].Clone()
  54. }
  55. }
  56. }
  57. if dst.RelayServerPort != nil {
  58. dst.RelayServerPort = ptr.To(*src.RelayServerPort)
  59. }
  60. dst.RelayServerStaticEndpoints = append(src.RelayServerStaticEndpoints[:0:0], src.RelayServerStaticEndpoints...)
  61. dst.Persist = src.Persist.Clone()
  62. return dst
  63. }
  64. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  65. var _PrefsCloneNeedsRegeneration = Prefs(struct {
  66. ControlURL string
  67. RouteAll bool
  68. ExitNodeID tailcfg.StableNodeID
  69. ExitNodeIP netip.Addr
  70. AutoExitNode ExitNodeExpression
  71. InternalExitNodePrior tailcfg.StableNodeID
  72. ExitNodeAllowLANAccess bool
  73. CorpDNS bool
  74. RunSSH bool
  75. RunWebClient bool
  76. WantRunning bool
  77. LoggedOut bool
  78. ShieldsUp bool
  79. AdvertiseTags []string
  80. Hostname string
  81. NotepadURLs bool
  82. ForceDaemon bool
  83. Egg bool
  84. AdvertiseRoutes []netip.Prefix
  85. AdvertiseServices []string
  86. Sync opt.Bool
  87. NoSNAT bool
  88. NoStatefulFiltering opt.Bool
  89. NetfilterMode preftype.NetfilterMode
  90. OperatorUser string
  91. ProfileName string
  92. AutoUpdate AutoUpdatePrefs
  93. AppConnector AppConnectorPrefs
  94. PostureChecking bool
  95. NetfilterKind string
  96. DriveShares []*drive.Share
  97. RelayServerPort *uint16
  98. RelayServerStaticEndpoints []netip.AddrPort
  99. AllowSingleHosts marshalAsTrueInJSON
  100. Persist *persist.Persist
  101. }{})
  102. // Clone makes a deep copy of ServeConfig.
  103. // The result aliases no memory with the original.
  104. func (src *ServeConfig) Clone() *ServeConfig {
  105. if src == nil {
  106. return nil
  107. }
  108. dst := new(ServeConfig)
  109. *dst = *src
  110. if dst.TCP != nil {
  111. dst.TCP = map[uint16]*TCPPortHandler{}
  112. for k, v := range src.TCP {
  113. if v == nil {
  114. dst.TCP[k] = nil
  115. } else {
  116. dst.TCP[k] = ptr.To(*v)
  117. }
  118. }
  119. }
  120. if dst.Web != nil {
  121. dst.Web = map[HostPort]*WebServerConfig{}
  122. for k, v := range src.Web {
  123. if v == nil {
  124. dst.Web[k] = nil
  125. } else {
  126. dst.Web[k] = v.Clone()
  127. }
  128. }
  129. }
  130. if dst.Services != nil {
  131. dst.Services = map[tailcfg.ServiceName]*ServiceConfig{}
  132. for k, v := range src.Services {
  133. if v == nil {
  134. dst.Services[k] = nil
  135. } else {
  136. dst.Services[k] = v.Clone()
  137. }
  138. }
  139. }
  140. dst.AllowFunnel = maps.Clone(src.AllowFunnel)
  141. if dst.Foreground != nil {
  142. dst.Foreground = map[string]*ServeConfig{}
  143. for k, v := range src.Foreground {
  144. if v == nil {
  145. dst.Foreground[k] = nil
  146. } else {
  147. dst.Foreground[k] = v.Clone()
  148. }
  149. }
  150. }
  151. return dst
  152. }
  153. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  154. var _ServeConfigCloneNeedsRegeneration = ServeConfig(struct {
  155. TCP map[uint16]*TCPPortHandler
  156. Web map[HostPort]*WebServerConfig
  157. Services map[tailcfg.ServiceName]*ServiceConfig
  158. AllowFunnel map[HostPort]bool
  159. Foreground map[string]*ServeConfig
  160. ETag string
  161. }{})
  162. // Clone makes a deep copy of ServiceConfig.
  163. // The result aliases no memory with the original.
  164. func (src *ServiceConfig) Clone() *ServiceConfig {
  165. if src == nil {
  166. return nil
  167. }
  168. dst := new(ServiceConfig)
  169. *dst = *src
  170. if dst.TCP != nil {
  171. dst.TCP = map[uint16]*TCPPortHandler{}
  172. for k, v := range src.TCP {
  173. if v == nil {
  174. dst.TCP[k] = nil
  175. } else {
  176. dst.TCP[k] = ptr.To(*v)
  177. }
  178. }
  179. }
  180. if dst.Web != nil {
  181. dst.Web = map[HostPort]*WebServerConfig{}
  182. for k, v := range src.Web {
  183. if v == nil {
  184. dst.Web[k] = nil
  185. } else {
  186. dst.Web[k] = v.Clone()
  187. }
  188. }
  189. }
  190. return dst
  191. }
  192. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  193. var _ServiceConfigCloneNeedsRegeneration = ServiceConfig(struct {
  194. TCP map[uint16]*TCPPortHandler
  195. Web map[HostPort]*WebServerConfig
  196. Tun bool
  197. }{})
  198. // Clone makes a deep copy of TCPPortHandler.
  199. // The result aliases no memory with the original.
  200. func (src *TCPPortHandler) Clone() *TCPPortHandler {
  201. if src == nil {
  202. return nil
  203. }
  204. dst := new(TCPPortHandler)
  205. *dst = *src
  206. return dst
  207. }
  208. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  209. var _TCPPortHandlerCloneNeedsRegeneration = TCPPortHandler(struct {
  210. HTTPS bool
  211. HTTP bool
  212. TCPForward string
  213. TerminateTLS string
  214. ProxyProtocol int
  215. }{})
  216. // Clone makes a deep copy of HTTPHandler.
  217. // The result aliases no memory with the original.
  218. func (src *HTTPHandler) Clone() *HTTPHandler {
  219. if src == nil {
  220. return nil
  221. }
  222. dst := new(HTTPHandler)
  223. *dst = *src
  224. dst.AcceptAppCaps = append(src.AcceptAppCaps[:0:0], src.AcceptAppCaps...)
  225. return dst
  226. }
  227. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  228. var _HTTPHandlerCloneNeedsRegeneration = HTTPHandler(struct {
  229. Path string
  230. Proxy string
  231. Text string
  232. AcceptAppCaps []tailcfg.PeerCapability
  233. Redirect string
  234. }{})
  235. // Clone makes a deep copy of WebServerConfig.
  236. // The result aliases no memory with the original.
  237. func (src *WebServerConfig) Clone() *WebServerConfig {
  238. if src == nil {
  239. return nil
  240. }
  241. dst := new(WebServerConfig)
  242. *dst = *src
  243. if dst.Handlers != nil {
  244. dst.Handlers = map[string]*HTTPHandler{}
  245. for k, v := range src.Handlers {
  246. if v == nil {
  247. dst.Handlers[k] = nil
  248. } else {
  249. dst.Handlers[k] = v.Clone()
  250. }
  251. }
  252. }
  253. return dst
  254. }
  255. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  256. var _WebServerConfigCloneNeedsRegeneration = WebServerConfig(struct {
  257. Handlers map[string]*HTTPHandler
  258. }{})