| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449 |
- // Copyright (c) Tailscale Inc & AUTHORS
- // SPDX-License-Identifier: BSD-3-Clause
- // Code generated by tailscale/cmd/viewer; DO NOT EDIT.
- package tailcfg
- import (
- "encoding/json"
- "errors"
- "net/netip"
- "time"
- "tailscale.com/types/dnstype"
- "tailscale.com/types/key"
- "tailscale.com/types/opt"
- "tailscale.com/types/structs"
- "tailscale.com/types/tkatype"
- "tailscale.com/types/views"
- )
- //go:generate go run tailscale.com/cmd/cloner -clonefunc=true -type=User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,RegisterResponseAuth,RegisterRequest,DERPHomeParams,DERPRegion,DERPMap,DERPNode,SSHRule,SSHAction,SSHPrincipal,ControlDialPlan,Location,UserProfile
- // View returns a readonly view of User.
- func (p *User) View() UserView {
- return UserView{ж: p}
- }
- // UserView provides a read-only view over User.
- //
- // Its methods should only be called if `Valid()` returns true.
- type UserView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *User
- }
- // Valid reports whether underlying value is non-nil.
- func (v UserView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v UserView) AsStruct() *User {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v UserView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *UserView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x User
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v UserView) ID() UserID { return v.ж.ID }
- func (v UserView) LoginName() string { return v.ж.LoginName }
- func (v UserView) DisplayName() string { return v.ж.DisplayName }
- func (v UserView) ProfilePicURL() string { return v.ж.ProfilePicURL }
- func (v UserView) Logins() views.Slice[LoginID] { return views.SliceOf(v.ж.Logins) }
- func (v UserView) Created() time.Time { return v.ж.Created }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _UserViewNeedsRegeneration = User(struct {
- ID UserID
- LoginName string
- DisplayName string
- ProfilePicURL string
- Logins []LoginID
- Created time.Time
- }{})
- // View returns a readonly view of Node.
- func (p *Node) View() NodeView {
- return NodeView{ж: p}
- }
- // NodeView provides a read-only view over Node.
- //
- // Its methods should only be called if `Valid()` returns true.
- type NodeView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *Node
- }
- // Valid reports whether underlying value is non-nil.
- func (v NodeView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v NodeView) AsStruct() *Node {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v NodeView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *NodeView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x Node
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v NodeView) ID() NodeID { return v.ж.ID }
- func (v NodeView) StableID() StableNodeID { return v.ж.StableID }
- func (v NodeView) Name() string { return v.ж.Name }
- func (v NodeView) User() UserID { return v.ж.User }
- func (v NodeView) Sharer() UserID { return v.ж.Sharer }
- func (v NodeView) Key() key.NodePublic { return v.ж.Key }
- func (v NodeView) KeyExpiry() time.Time { return v.ж.KeyExpiry }
- func (v NodeView) KeySignature() views.ByteSlice[tkatype.MarshaledSignature] {
- return views.ByteSliceOf(v.ж.KeySignature)
- }
- func (v NodeView) Machine() key.MachinePublic { return v.ж.Machine }
- func (v NodeView) DiscoKey() key.DiscoPublic { return v.ж.DiscoKey }
- func (v NodeView) Addresses() views.Slice[netip.Prefix] { return views.SliceOf(v.ж.Addresses) }
- func (v NodeView) AllowedIPs() views.Slice[netip.Prefix] { return views.SliceOf(v.ж.AllowedIPs) }
- func (v NodeView) Endpoints() views.Slice[netip.AddrPort] { return views.SliceOf(v.ж.Endpoints) }
- func (v NodeView) DERP() string { return v.ж.DERP }
- func (v NodeView) Hostinfo() HostinfoView { return v.ж.Hostinfo }
- func (v NodeView) Created() time.Time { return v.ж.Created }
- func (v NodeView) Cap() CapabilityVersion { return v.ж.Cap }
- func (v NodeView) Tags() views.Slice[string] { return views.SliceOf(v.ж.Tags) }
- func (v NodeView) PrimaryRoutes() views.Slice[netip.Prefix] { return views.SliceOf(v.ж.PrimaryRoutes) }
- func (v NodeView) LastSeen() *time.Time {
- if v.ж.LastSeen == nil {
- return nil
- }
- x := *v.ж.LastSeen
- return &x
- }
- func (v NodeView) Online() *bool {
- if v.ж.Online == nil {
- return nil
- }
- x := *v.ж.Online
- return &x
- }
- func (v NodeView) MachineAuthorized() bool { return v.ж.MachineAuthorized }
- func (v NodeView) Capabilities() views.Slice[NodeCapability] { return views.SliceOf(v.ж.Capabilities) }
- func (v NodeView) CapMap() views.MapFn[NodeCapability, []RawMessage, views.Slice[RawMessage]] {
- return views.MapFnOf(v.ж.CapMap, func(t []RawMessage) views.Slice[RawMessage] {
- return views.SliceOf(t)
- })
- }
- func (v NodeView) UnsignedPeerAPIOnly() bool { return v.ж.UnsignedPeerAPIOnly }
- func (v NodeView) ComputedName() string { return v.ж.ComputedName }
- func (v NodeView) ComputedNameWithHost() string { return v.ж.ComputedNameWithHost }
- func (v NodeView) DataPlaneAuditLogID() string { return v.ж.DataPlaneAuditLogID }
- func (v NodeView) Expired() bool { return v.ж.Expired }
- func (v NodeView) SelfNodeV4MasqAddrForThisPeer() *netip.Addr {
- if v.ж.SelfNodeV4MasqAddrForThisPeer == nil {
- return nil
- }
- x := *v.ж.SelfNodeV4MasqAddrForThisPeer
- return &x
- }
- func (v NodeView) SelfNodeV6MasqAddrForThisPeer() *netip.Addr {
- if v.ж.SelfNodeV6MasqAddrForThisPeer == nil {
- return nil
- }
- x := *v.ж.SelfNodeV6MasqAddrForThisPeer
- return &x
- }
- func (v NodeView) IsWireGuardOnly() bool { return v.ж.IsWireGuardOnly }
- func (v NodeView) ExitNodeDNSResolvers() views.SliceView[*dnstype.Resolver, dnstype.ResolverView] {
- return views.SliceOfViews[*dnstype.Resolver, dnstype.ResolverView](v.ж.ExitNodeDNSResolvers)
- }
- func (v NodeView) Equal(v2 NodeView) bool { return v.ж.Equal(v2.ж) }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _NodeViewNeedsRegeneration = Node(struct {
- ID NodeID
- StableID StableNodeID
- Name string
- User UserID
- Sharer UserID
- Key key.NodePublic
- KeyExpiry time.Time
- KeySignature tkatype.MarshaledSignature
- Machine key.MachinePublic
- DiscoKey key.DiscoPublic
- Addresses []netip.Prefix
- AllowedIPs []netip.Prefix
- Endpoints []netip.AddrPort
- DERP string
- Hostinfo HostinfoView
- Created time.Time
- Cap CapabilityVersion
- Tags []string
- PrimaryRoutes []netip.Prefix
- LastSeen *time.Time
- Online *bool
- MachineAuthorized bool
- Capabilities []NodeCapability
- CapMap NodeCapMap
- UnsignedPeerAPIOnly bool
- ComputedName string
- computedHostIfDifferent string
- ComputedNameWithHost string
- DataPlaneAuditLogID string
- Expired bool
- SelfNodeV4MasqAddrForThisPeer *netip.Addr
- SelfNodeV6MasqAddrForThisPeer *netip.Addr
- IsWireGuardOnly bool
- ExitNodeDNSResolvers []*dnstype.Resolver
- }{})
- // View returns a readonly view of Hostinfo.
- func (p *Hostinfo) View() HostinfoView {
- return HostinfoView{ж: p}
- }
- // HostinfoView provides a read-only view over Hostinfo.
- //
- // Its methods should only be called if `Valid()` returns true.
- type HostinfoView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *Hostinfo
- }
- // Valid reports whether underlying value is non-nil.
- func (v HostinfoView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v HostinfoView) AsStruct() *Hostinfo {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v HostinfoView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *HostinfoView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x Hostinfo
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v HostinfoView) IPNVersion() string { return v.ж.IPNVersion }
- func (v HostinfoView) FrontendLogID() string { return v.ж.FrontendLogID }
- func (v HostinfoView) BackendLogID() string { return v.ж.BackendLogID }
- func (v HostinfoView) OS() string { return v.ж.OS }
- func (v HostinfoView) OSVersion() string { return v.ж.OSVersion }
- func (v HostinfoView) Container() opt.Bool { return v.ж.Container }
- func (v HostinfoView) Env() string { return v.ж.Env }
- func (v HostinfoView) Distro() string { return v.ж.Distro }
- func (v HostinfoView) DistroVersion() string { return v.ж.DistroVersion }
- func (v HostinfoView) DistroCodeName() string { return v.ж.DistroCodeName }
- func (v HostinfoView) App() string { return v.ж.App }
- func (v HostinfoView) Desktop() opt.Bool { return v.ж.Desktop }
- func (v HostinfoView) Package() string { return v.ж.Package }
- func (v HostinfoView) DeviceModel() string { return v.ж.DeviceModel }
- func (v HostinfoView) PushDeviceToken() string { return v.ж.PushDeviceToken }
- func (v HostinfoView) Hostname() string { return v.ж.Hostname }
- func (v HostinfoView) ShieldsUp() bool { return v.ж.ShieldsUp }
- func (v HostinfoView) ShareeNode() bool { return v.ж.ShareeNode }
- func (v HostinfoView) NoLogsNoSupport() bool { return v.ж.NoLogsNoSupport }
- func (v HostinfoView) WireIngress() bool { return v.ж.WireIngress }
- func (v HostinfoView) AllowsUpdate() bool { return v.ж.AllowsUpdate }
- func (v HostinfoView) Machine() string { return v.ж.Machine }
- func (v HostinfoView) GoArch() string { return v.ж.GoArch }
- func (v HostinfoView) GoArchVar() string { return v.ж.GoArchVar }
- func (v HostinfoView) GoVersion() string { return v.ж.GoVersion }
- func (v HostinfoView) RoutableIPs() views.Slice[netip.Prefix] { return views.SliceOf(v.ж.RoutableIPs) }
- func (v HostinfoView) RequestTags() views.Slice[string] { return views.SliceOf(v.ж.RequestTags) }
- func (v HostinfoView) WoLMACs() views.Slice[string] { return views.SliceOf(v.ж.WoLMACs) }
- func (v HostinfoView) Services() views.Slice[Service] { return views.SliceOf(v.ж.Services) }
- func (v HostinfoView) NetInfo() NetInfoView { return v.ж.NetInfo.View() }
- func (v HostinfoView) SSH_HostKeys() views.Slice[string] { return views.SliceOf(v.ж.SSH_HostKeys) }
- func (v HostinfoView) Cloud() string { return v.ж.Cloud }
- func (v HostinfoView) Userspace() opt.Bool { return v.ж.Userspace }
- func (v HostinfoView) UserspaceRouter() opt.Bool { return v.ж.UserspaceRouter }
- func (v HostinfoView) AppConnector() opt.Bool { return v.ж.AppConnector }
- func (v HostinfoView) Location() *Location {
- if v.ж.Location == nil {
- return nil
- }
- x := *v.ж.Location
- return &x
- }
- func (v HostinfoView) Equal(v2 HostinfoView) bool { return v.ж.Equal(v2.ж) }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _HostinfoViewNeedsRegeneration = Hostinfo(struct {
- IPNVersion string
- FrontendLogID string
- BackendLogID string
- OS string
- OSVersion string
- Container opt.Bool
- Env string
- Distro string
- DistroVersion string
- DistroCodeName string
- App string
- Desktop opt.Bool
- Package string
- DeviceModel string
- PushDeviceToken string
- Hostname string
- ShieldsUp bool
- ShareeNode bool
- NoLogsNoSupport bool
- WireIngress bool
- AllowsUpdate bool
- Machine string
- GoArch string
- GoArchVar string
- GoVersion string
- RoutableIPs []netip.Prefix
- RequestTags []string
- WoLMACs []string
- Services []Service
- NetInfo *NetInfo
- SSH_HostKeys []string
- Cloud string
- Userspace opt.Bool
- UserspaceRouter opt.Bool
- AppConnector opt.Bool
- Location *Location
- }{})
- // View returns a readonly view of NetInfo.
- func (p *NetInfo) View() NetInfoView {
- return NetInfoView{ж: p}
- }
- // NetInfoView provides a read-only view over NetInfo.
- //
- // Its methods should only be called if `Valid()` returns true.
- type NetInfoView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *NetInfo
- }
- // Valid reports whether underlying value is non-nil.
- func (v NetInfoView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v NetInfoView) AsStruct() *NetInfo {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v NetInfoView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *NetInfoView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x NetInfo
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v NetInfoView) MappingVariesByDestIP() opt.Bool { return v.ж.MappingVariesByDestIP }
- func (v NetInfoView) HairPinning() opt.Bool { return v.ж.HairPinning }
- func (v NetInfoView) WorkingIPv6() opt.Bool { return v.ж.WorkingIPv6 }
- func (v NetInfoView) OSHasIPv6() opt.Bool { return v.ж.OSHasIPv6 }
- func (v NetInfoView) WorkingUDP() opt.Bool { return v.ж.WorkingUDP }
- func (v NetInfoView) WorkingICMPv4() opt.Bool { return v.ж.WorkingICMPv4 }
- func (v NetInfoView) HavePortMap() bool { return v.ж.HavePortMap }
- func (v NetInfoView) UPnP() opt.Bool { return v.ж.UPnP }
- func (v NetInfoView) PMP() opt.Bool { return v.ж.PMP }
- func (v NetInfoView) PCP() opt.Bool { return v.ж.PCP }
- func (v NetInfoView) PreferredDERP() int { return v.ж.PreferredDERP }
- func (v NetInfoView) LinkType() string { return v.ж.LinkType }
- func (v NetInfoView) DERPLatency() views.Map[string, float64] { return views.MapOf(v.ж.DERPLatency) }
- func (v NetInfoView) FirewallMode() string { return v.ж.FirewallMode }
- func (v NetInfoView) String() string { return v.ж.String() }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _NetInfoViewNeedsRegeneration = NetInfo(struct {
- MappingVariesByDestIP opt.Bool
- HairPinning opt.Bool
- WorkingIPv6 opt.Bool
- OSHasIPv6 opt.Bool
- WorkingUDP opt.Bool
- WorkingICMPv4 opt.Bool
- HavePortMap bool
- UPnP opt.Bool
- PMP opt.Bool
- PCP opt.Bool
- PreferredDERP int
- LinkType string
- DERPLatency map[string]float64
- FirewallMode string
- }{})
- // View returns a readonly view of Login.
- func (p *Login) View() LoginView {
- return LoginView{ж: p}
- }
- // LoginView provides a read-only view over Login.
- //
- // Its methods should only be called if `Valid()` returns true.
- type LoginView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *Login
- }
- // Valid reports whether underlying value is non-nil.
- func (v LoginView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v LoginView) AsStruct() *Login {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v LoginView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *LoginView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x Login
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v LoginView) ID() LoginID { return v.ж.ID }
- func (v LoginView) Provider() string { return v.ж.Provider }
- func (v LoginView) LoginName() string { return v.ж.LoginName }
- func (v LoginView) DisplayName() string { return v.ж.DisplayName }
- func (v LoginView) ProfilePicURL() string { return v.ж.ProfilePicURL }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _LoginViewNeedsRegeneration = Login(struct {
- _ structs.Incomparable
- ID LoginID
- Provider string
- LoginName string
- DisplayName string
- ProfilePicURL string
- }{})
- // View returns a readonly view of DNSConfig.
- func (p *DNSConfig) View() DNSConfigView {
- return DNSConfigView{ж: p}
- }
- // DNSConfigView provides a read-only view over DNSConfig.
- //
- // Its methods should only be called if `Valid()` returns true.
- type DNSConfigView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *DNSConfig
- }
- // Valid reports whether underlying value is non-nil.
- func (v DNSConfigView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v DNSConfigView) AsStruct() *DNSConfig {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v DNSConfigView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *DNSConfigView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x DNSConfig
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v DNSConfigView) Resolvers() views.SliceView[*dnstype.Resolver, dnstype.ResolverView] {
- return views.SliceOfViews[*dnstype.Resolver, dnstype.ResolverView](v.ж.Resolvers)
- }
- func (v DNSConfigView) Routes() views.MapFn[string, []*dnstype.Resolver, views.SliceView[*dnstype.Resolver, dnstype.ResolverView]] {
- return views.MapFnOf(v.ж.Routes, func(t []*dnstype.Resolver) views.SliceView[*dnstype.Resolver, dnstype.ResolverView] {
- return views.SliceOfViews[*dnstype.Resolver, dnstype.ResolverView](t)
- })
- }
- func (v DNSConfigView) FallbackResolvers() views.SliceView[*dnstype.Resolver, dnstype.ResolverView] {
- return views.SliceOfViews[*dnstype.Resolver, dnstype.ResolverView](v.ж.FallbackResolvers)
- }
- func (v DNSConfigView) Domains() views.Slice[string] { return views.SliceOf(v.ж.Domains) }
- func (v DNSConfigView) Proxied() bool { return v.ж.Proxied }
- func (v DNSConfigView) Nameservers() views.Slice[netip.Addr] { return views.SliceOf(v.ж.Nameservers) }
- func (v DNSConfigView) CertDomains() views.Slice[string] { return views.SliceOf(v.ж.CertDomains) }
- func (v DNSConfigView) ExtraRecords() views.Slice[DNSRecord] { return views.SliceOf(v.ж.ExtraRecords) }
- func (v DNSConfigView) ExitNodeFilteredSet() views.Slice[string] {
- return views.SliceOf(v.ж.ExitNodeFilteredSet)
- }
- func (v DNSConfigView) TempCorpIssue13969() string { return v.ж.TempCorpIssue13969 }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _DNSConfigViewNeedsRegeneration = DNSConfig(struct {
- Resolvers []*dnstype.Resolver
- Routes map[string][]*dnstype.Resolver
- FallbackResolvers []*dnstype.Resolver
- Domains []string
- Proxied bool
- Nameservers []netip.Addr
- CertDomains []string
- ExtraRecords []DNSRecord
- ExitNodeFilteredSet []string
- TempCorpIssue13969 string
- }{})
- // View returns a readonly view of RegisterResponse.
- func (p *RegisterResponse) View() RegisterResponseView {
- return RegisterResponseView{ж: p}
- }
- // RegisterResponseView provides a read-only view over RegisterResponse.
- //
- // Its methods should only be called if `Valid()` returns true.
- type RegisterResponseView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *RegisterResponse
- }
- // Valid reports whether underlying value is non-nil.
- func (v RegisterResponseView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v RegisterResponseView) AsStruct() *RegisterResponse {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v RegisterResponseView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *RegisterResponseView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x RegisterResponse
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v RegisterResponseView) User() UserView { return v.ж.User.View() }
- func (v RegisterResponseView) Login() Login { return v.ж.Login }
- func (v RegisterResponseView) NodeKeyExpired() bool { return v.ж.NodeKeyExpired }
- func (v RegisterResponseView) MachineAuthorized() bool { return v.ж.MachineAuthorized }
- func (v RegisterResponseView) AuthURL() string { return v.ж.AuthURL }
- func (v RegisterResponseView) NodeKeySignature() views.ByteSlice[tkatype.MarshaledSignature] {
- return views.ByteSliceOf(v.ж.NodeKeySignature)
- }
- func (v RegisterResponseView) Error() string { return v.ж.Error }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _RegisterResponseViewNeedsRegeneration = RegisterResponse(struct {
- User User
- Login Login
- NodeKeyExpired bool
- MachineAuthorized bool
- AuthURL string
- NodeKeySignature tkatype.MarshaledSignature
- Error string
- }{})
- // View returns a readonly view of RegisterResponseAuth.
- func (p *RegisterResponseAuth) View() RegisterResponseAuthView {
- return RegisterResponseAuthView{ж: p}
- }
- // RegisterResponseAuthView provides a read-only view over RegisterResponseAuth.
- //
- // Its methods should only be called if `Valid()` returns true.
- type RegisterResponseAuthView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *RegisterResponseAuth
- }
- // Valid reports whether underlying value is non-nil.
- func (v RegisterResponseAuthView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v RegisterResponseAuthView) AsStruct() *RegisterResponseAuth {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v RegisterResponseAuthView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *RegisterResponseAuthView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x RegisterResponseAuth
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v RegisterResponseAuthView) Provider() string { return v.ж.Provider }
- func (v RegisterResponseAuthView) LoginName() string { return v.ж.LoginName }
- func (v RegisterResponseAuthView) Oauth2Token() *Oauth2Token {
- if v.ж.Oauth2Token == nil {
- return nil
- }
- x := *v.ж.Oauth2Token
- return &x
- }
- func (v RegisterResponseAuthView) AuthKey() string { return v.ж.AuthKey }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _RegisterResponseAuthViewNeedsRegeneration = RegisterResponseAuth(struct {
- _ structs.Incomparable
- Provider string
- LoginName string
- Oauth2Token *Oauth2Token
- AuthKey string
- }{})
- // View returns a readonly view of RegisterRequest.
- func (p *RegisterRequest) View() RegisterRequestView {
- return RegisterRequestView{ж: p}
- }
- // RegisterRequestView provides a read-only view over RegisterRequest.
- //
- // Its methods should only be called if `Valid()` returns true.
- type RegisterRequestView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *RegisterRequest
- }
- // Valid reports whether underlying value is non-nil.
- func (v RegisterRequestView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v RegisterRequestView) AsStruct() *RegisterRequest {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v RegisterRequestView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *RegisterRequestView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x RegisterRequest
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v RegisterRequestView) Version() CapabilityVersion { return v.ж.Version }
- func (v RegisterRequestView) NodeKey() key.NodePublic { return v.ж.NodeKey }
- func (v RegisterRequestView) OldNodeKey() key.NodePublic { return v.ж.OldNodeKey }
- func (v RegisterRequestView) NLKey() key.NLPublic { return v.ж.NLKey }
- func (v RegisterRequestView) Auth() RegisterResponseAuthView { return v.ж.Auth.View() }
- func (v RegisterRequestView) Expiry() time.Time { return v.ж.Expiry }
- func (v RegisterRequestView) Followup() string { return v.ж.Followup }
- func (v RegisterRequestView) Hostinfo() HostinfoView { return v.ж.Hostinfo.View() }
- func (v RegisterRequestView) Ephemeral() bool { return v.ж.Ephemeral }
- func (v RegisterRequestView) NodeKeySignature() views.ByteSlice[tkatype.MarshaledSignature] {
- return views.ByteSliceOf(v.ж.NodeKeySignature)
- }
- func (v RegisterRequestView) SignatureType() SignatureType { return v.ж.SignatureType }
- func (v RegisterRequestView) Timestamp() *time.Time {
- if v.ж.Timestamp == nil {
- return nil
- }
- x := *v.ж.Timestamp
- return &x
- }
- func (v RegisterRequestView) DeviceCert() views.ByteSlice[[]byte] {
- return views.ByteSliceOf(v.ж.DeviceCert)
- }
- func (v RegisterRequestView) Signature() views.ByteSlice[[]byte] {
- return views.ByteSliceOf(v.ж.Signature)
- }
- func (v RegisterRequestView) Tailnet() string { return v.ж.Tailnet }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _RegisterRequestViewNeedsRegeneration = RegisterRequest(struct {
- _ structs.Incomparable
- Version CapabilityVersion
- NodeKey key.NodePublic
- OldNodeKey key.NodePublic
- NLKey key.NLPublic
- Auth RegisterResponseAuth
- Expiry time.Time
- Followup string
- Hostinfo *Hostinfo
- Ephemeral bool
- NodeKeySignature tkatype.MarshaledSignature
- SignatureType SignatureType
- Timestamp *time.Time
- DeviceCert []byte
- Signature []byte
- Tailnet string
- }{})
- // View returns a readonly view of DERPHomeParams.
- func (p *DERPHomeParams) View() DERPHomeParamsView {
- return DERPHomeParamsView{ж: p}
- }
- // DERPHomeParamsView provides a read-only view over DERPHomeParams.
- //
- // Its methods should only be called if `Valid()` returns true.
- type DERPHomeParamsView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *DERPHomeParams
- }
- // Valid reports whether underlying value is non-nil.
- func (v DERPHomeParamsView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v DERPHomeParamsView) AsStruct() *DERPHomeParams {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v DERPHomeParamsView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *DERPHomeParamsView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x DERPHomeParams
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v DERPHomeParamsView) RegionScore() views.Map[int, float64] {
- return views.MapOf(v.ж.RegionScore)
- }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _DERPHomeParamsViewNeedsRegeneration = DERPHomeParams(struct {
- RegionScore map[int]float64
- }{})
- // View returns a readonly view of DERPRegion.
- func (p *DERPRegion) View() DERPRegionView {
- return DERPRegionView{ж: p}
- }
- // DERPRegionView provides a read-only view over DERPRegion.
- //
- // Its methods should only be called if `Valid()` returns true.
- type DERPRegionView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *DERPRegion
- }
- // Valid reports whether underlying value is non-nil.
- func (v DERPRegionView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v DERPRegionView) AsStruct() *DERPRegion {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v DERPRegionView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *DERPRegionView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x DERPRegion
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v DERPRegionView) RegionID() int { return v.ж.RegionID }
- func (v DERPRegionView) RegionCode() string { return v.ж.RegionCode }
- func (v DERPRegionView) RegionName() string { return v.ж.RegionName }
- func (v DERPRegionView) Avoid() bool { return v.ж.Avoid }
- func (v DERPRegionView) Nodes() views.SliceView[*DERPNode, DERPNodeView] {
- return views.SliceOfViews[*DERPNode, DERPNodeView](v.ж.Nodes)
- }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _DERPRegionViewNeedsRegeneration = DERPRegion(struct {
- RegionID int
- RegionCode string
- RegionName string
- Avoid bool
- Nodes []*DERPNode
- }{})
- // View returns a readonly view of DERPMap.
- func (p *DERPMap) View() DERPMapView {
- return DERPMapView{ж: p}
- }
- // DERPMapView provides a read-only view over DERPMap.
- //
- // Its methods should only be called if `Valid()` returns true.
- type DERPMapView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *DERPMap
- }
- // Valid reports whether underlying value is non-nil.
- func (v DERPMapView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v DERPMapView) AsStruct() *DERPMap {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v DERPMapView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *DERPMapView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x DERPMap
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v DERPMapView) HomeParams() DERPHomeParamsView { return v.ж.HomeParams.View() }
- func (v DERPMapView) Regions() views.MapFn[int, *DERPRegion, DERPRegionView] {
- return views.MapFnOf(v.ж.Regions, func(t *DERPRegion) DERPRegionView {
- return t.View()
- })
- }
- func (v DERPMapView) OmitDefaultRegions() bool { return v.ж.OmitDefaultRegions }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _DERPMapViewNeedsRegeneration = DERPMap(struct {
- HomeParams *DERPHomeParams
- Regions map[int]*DERPRegion
- OmitDefaultRegions bool
- }{})
- // View returns a readonly view of DERPNode.
- func (p *DERPNode) View() DERPNodeView {
- return DERPNodeView{ж: p}
- }
- // DERPNodeView provides a read-only view over DERPNode.
- //
- // Its methods should only be called if `Valid()` returns true.
- type DERPNodeView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *DERPNode
- }
- // Valid reports whether underlying value is non-nil.
- func (v DERPNodeView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v DERPNodeView) AsStruct() *DERPNode {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v DERPNodeView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *DERPNodeView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x DERPNode
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v DERPNodeView) Name() string { return v.ж.Name }
- func (v DERPNodeView) RegionID() int { return v.ж.RegionID }
- func (v DERPNodeView) HostName() string { return v.ж.HostName }
- func (v DERPNodeView) CertName() string { return v.ж.CertName }
- func (v DERPNodeView) IPv4() string { return v.ж.IPv4 }
- func (v DERPNodeView) IPv6() string { return v.ж.IPv6 }
- func (v DERPNodeView) STUNPort() int { return v.ж.STUNPort }
- func (v DERPNodeView) STUNOnly() bool { return v.ж.STUNOnly }
- func (v DERPNodeView) DERPPort() int { return v.ж.DERPPort }
- func (v DERPNodeView) InsecureForTests() bool { return v.ж.InsecureForTests }
- func (v DERPNodeView) STUNTestIP() string { return v.ж.STUNTestIP }
- func (v DERPNodeView) CanPort80() bool { return v.ж.CanPort80 }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _DERPNodeViewNeedsRegeneration = DERPNode(struct {
- Name string
- RegionID int
- HostName string
- CertName string
- IPv4 string
- IPv6 string
- STUNPort int
- STUNOnly bool
- DERPPort int
- InsecureForTests bool
- STUNTestIP string
- CanPort80 bool
- }{})
- // View returns a readonly view of SSHRule.
- func (p *SSHRule) View() SSHRuleView {
- return SSHRuleView{ж: p}
- }
- // SSHRuleView provides a read-only view over SSHRule.
- //
- // Its methods should only be called if `Valid()` returns true.
- type SSHRuleView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *SSHRule
- }
- // Valid reports whether underlying value is non-nil.
- func (v SSHRuleView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v SSHRuleView) AsStruct() *SSHRule {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v SSHRuleView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *SSHRuleView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x SSHRule
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v SSHRuleView) RuleExpires() *time.Time {
- if v.ж.RuleExpires == nil {
- return nil
- }
- x := *v.ж.RuleExpires
- return &x
- }
- func (v SSHRuleView) Principals() views.SliceView[*SSHPrincipal, SSHPrincipalView] {
- return views.SliceOfViews[*SSHPrincipal, SSHPrincipalView](v.ж.Principals)
- }
- func (v SSHRuleView) SSHUsers() views.Map[string, string] { return views.MapOf(v.ж.SSHUsers) }
- func (v SSHRuleView) Action() SSHActionView { return v.ж.Action.View() }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _SSHRuleViewNeedsRegeneration = SSHRule(struct {
- RuleExpires *time.Time
- Principals []*SSHPrincipal
- SSHUsers map[string]string
- Action *SSHAction
- }{})
- // View returns a readonly view of SSHAction.
- func (p *SSHAction) View() SSHActionView {
- return SSHActionView{ж: p}
- }
- // SSHActionView provides a read-only view over SSHAction.
- //
- // Its methods should only be called if `Valid()` returns true.
- type SSHActionView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *SSHAction
- }
- // Valid reports whether underlying value is non-nil.
- func (v SSHActionView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v SSHActionView) AsStruct() *SSHAction {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v SSHActionView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *SSHActionView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x SSHAction
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v SSHActionView) Message() string { return v.ж.Message }
- func (v SSHActionView) Reject() bool { return v.ж.Reject }
- func (v SSHActionView) Accept() bool { return v.ж.Accept }
- func (v SSHActionView) SessionDuration() time.Duration { return v.ж.SessionDuration }
- func (v SSHActionView) AllowAgentForwarding() bool { return v.ж.AllowAgentForwarding }
- func (v SSHActionView) HoldAndDelegate() string { return v.ж.HoldAndDelegate }
- func (v SSHActionView) AllowLocalPortForwarding() bool { return v.ж.AllowLocalPortForwarding }
- func (v SSHActionView) AllowRemotePortForwarding() bool { return v.ж.AllowRemotePortForwarding }
- func (v SSHActionView) Recorders() views.Slice[netip.AddrPort] { return views.SliceOf(v.ж.Recorders) }
- func (v SSHActionView) OnRecordingFailure() *SSHRecorderFailureAction {
- if v.ж.OnRecordingFailure == nil {
- return nil
- }
- x := *v.ж.OnRecordingFailure
- return &x
- }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _SSHActionViewNeedsRegeneration = SSHAction(struct {
- Message string
- Reject bool
- Accept bool
- SessionDuration time.Duration
- AllowAgentForwarding bool
- HoldAndDelegate string
- AllowLocalPortForwarding bool
- AllowRemotePortForwarding bool
- Recorders []netip.AddrPort
- OnRecordingFailure *SSHRecorderFailureAction
- }{})
- // View returns a readonly view of SSHPrincipal.
- func (p *SSHPrincipal) View() SSHPrincipalView {
- return SSHPrincipalView{ж: p}
- }
- // SSHPrincipalView provides a read-only view over SSHPrincipal.
- //
- // Its methods should only be called if `Valid()` returns true.
- type SSHPrincipalView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *SSHPrincipal
- }
- // Valid reports whether underlying value is non-nil.
- func (v SSHPrincipalView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v SSHPrincipalView) AsStruct() *SSHPrincipal {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v SSHPrincipalView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *SSHPrincipalView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x SSHPrincipal
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v SSHPrincipalView) Node() StableNodeID { return v.ж.Node }
- func (v SSHPrincipalView) NodeIP() string { return v.ж.NodeIP }
- func (v SSHPrincipalView) UserLogin() string { return v.ж.UserLogin }
- func (v SSHPrincipalView) Any() bool { return v.ж.Any }
- func (v SSHPrincipalView) PubKeys() views.Slice[string] { return views.SliceOf(v.ж.PubKeys) }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _SSHPrincipalViewNeedsRegeneration = SSHPrincipal(struct {
- Node StableNodeID
- NodeIP string
- UserLogin string
- Any bool
- PubKeys []string
- }{})
- // View returns a readonly view of ControlDialPlan.
- func (p *ControlDialPlan) View() ControlDialPlanView {
- return ControlDialPlanView{ж: p}
- }
- // ControlDialPlanView provides a read-only view over ControlDialPlan.
- //
- // Its methods should only be called if `Valid()` returns true.
- type ControlDialPlanView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *ControlDialPlan
- }
- // Valid reports whether underlying value is non-nil.
- func (v ControlDialPlanView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v ControlDialPlanView) AsStruct() *ControlDialPlan {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v ControlDialPlanView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *ControlDialPlanView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x ControlDialPlan
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v ControlDialPlanView) Candidates() views.Slice[ControlIPCandidate] {
- return views.SliceOf(v.ж.Candidates)
- }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _ControlDialPlanViewNeedsRegeneration = ControlDialPlan(struct {
- Candidates []ControlIPCandidate
- }{})
- // View returns a readonly view of Location.
- func (p *Location) View() LocationView {
- return LocationView{ж: p}
- }
- // LocationView provides a read-only view over Location.
- //
- // Its methods should only be called if `Valid()` returns true.
- type LocationView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *Location
- }
- // Valid reports whether underlying value is non-nil.
- func (v LocationView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v LocationView) AsStruct() *Location {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v LocationView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *LocationView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x Location
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v LocationView) Country() string { return v.ж.Country }
- func (v LocationView) CountryCode() string { return v.ж.CountryCode }
- func (v LocationView) City() string { return v.ж.City }
- func (v LocationView) CityCode() string { return v.ж.CityCode }
- func (v LocationView) Priority() int { return v.ж.Priority }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _LocationViewNeedsRegeneration = Location(struct {
- Country string
- CountryCode string
- City string
- CityCode string
- Priority int
- }{})
- // View returns a readonly view of UserProfile.
- func (p *UserProfile) View() UserProfileView {
- return UserProfileView{ж: p}
- }
- // UserProfileView provides a read-only view over UserProfile.
- //
- // Its methods should only be called if `Valid()` returns true.
- type UserProfileView struct {
- // ж is the underlying mutable value, named with a hard-to-type
- // character that looks pointy like a pointer.
- // It is named distinctively to make you think of how dangerous it is to escape
- // to callers. You must not let callers be able to mutate it.
- ж *UserProfile
- }
- // Valid reports whether underlying value is non-nil.
- func (v UserProfileView) Valid() bool { return v.ж != nil }
- // AsStruct returns a clone of the underlying value which aliases no memory with
- // the original.
- func (v UserProfileView) AsStruct() *UserProfile {
- if v.ж == nil {
- return nil
- }
- return v.ж.Clone()
- }
- func (v UserProfileView) MarshalJSON() ([]byte, error) { return json.Marshal(v.ж) }
- func (v *UserProfileView) UnmarshalJSON(b []byte) error {
- if v.ж != nil {
- return errors.New("already initialized")
- }
- if len(b) == 0 {
- return nil
- }
- var x UserProfile
- if err := json.Unmarshal(b, &x); err != nil {
- return err
- }
- v.ж = &x
- return nil
- }
- func (v UserProfileView) ID() UserID { return v.ж.ID }
- func (v UserProfileView) LoginName() string { return v.ж.LoginName }
- func (v UserProfileView) DisplayName() string { return v.ж.DisplayName }
- func (v UserProfileView) ProfilePicURL() string { return v.ж.ProfilePicURL }
- func (v UserProfileView) Roles() emptyStructJSONSlice { return v.ж.Roles }
- func (v UserProfileView) Groups() views.Slice[string] { return views.SliceOf(v.ж.Groups) }
- func (v UserProfileView) Equal(v2 UserProfileView) bool { return v.ж.Equal(v2.ж) }
- // A compilation failure here means this code must be regenerated, with the command at the top of this file.
- var _UserProfileViewNeedsRegeneration = UserProfile(struct {
- ID UserID
- LoginName string
- DisplayName string
- ProfilePicURL string
- Roles emptyStructJSONSlice
- Groups []string
- }{})
|