diff options
Diffstat (limited to 'tailcfg')
| -rw-r--r-- | tailcfg/tailcfg.go | 1 | ||||
| -rw-r--r-- | tailcfg/tailcfg_view.go | 239 |
2 files changed, 240 insertions, 0 deletions
diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go index bef39bb2b..538a8e88e 100644 --- a/tailcfg/tailcfg.go +++ b/tailcfg/tailcfg.go @@ -5,6 +5,7 @@ package tailcfg //go:generate go run tailscale.com/cmd/cloner --type=User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode --clonefunc=true --output=tailcfg_clone.go +//go:generate go run tailscale.com/cmd/viewer --type=Node,Hostinfo,DNSConfig,NetInfo,DERPMap --output=tailcfg_view.go import ( "encoding/hex" diff --git a/tailcfg/tailcfg_view.go b/tailcfg/tailcfg_view.go new file mode 100644 index 000000000..60661b607 --- /dev/null +++ b/tailcfg/tailcfg_view.go @@ -0,0 +1,239 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/viewer -type Node,Hostinfo,DNSConfig,NetInfo,DERPMap + +package tailcfg + +import ( + "inet.af/netaddr" + "tailscale.com/types/dnstype" + "tailscale.com/types/key" + "tailscale.com/types/opt" + "time" +) + +// View makes a readonly view of Node. +func (src *Node) View() NodeView { + return NodeView{src} +} + +// NodeView is a readonly view of Node. +type NodeView struct{ ж *Node } + +func (v NodeView) Valid() bool { return v.ж != 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() NodeKey { return v.ж.Key } +func (v NodeView) KeyExpiry() time.Time { return v.ж.KeyExpiry } +func (v NodeView) Machine() key.MachinePublic { return v.ж.Machine } +func (v NodeView) DiscoKey() DiscoKey { return v.ж.DiscoKey } +func (v NodeView) Addresses() []netaddr.IPPrefix { return v.ж.Addresses } +func (v NodeView) AllowedIPs() []netaddr.IPPrefix { return v.ж.AllowedIPs } +func (v NodeView) Endpoints() []string { return v.ж.Endpoints } +func (v NodeView) DERP() string { return v.ж.DERP } +func (v NodeView) Hostinfo() HostinfoView { return v.ж.Hostinfo.View() } +func (v NodeView) Created() time.Time { return v.ж.Created } +func (v NodeView) PrimaryRoutes() []netaddr.IPPrefix { return v.ж.PrimaryRoutes } +func (v NodeView) LastSeen() *time.Time { + ptr := v.ж.LastSeen + if ptr == nil { + return nil + } + cp := *ptr + return &cp +} +func (v NodeView) Online() *bool { + ptr := v.ж.Online + if ptr == nil { + return nil + } + cp := *ptr + return &cp +} +func (v NodeView) KeepAlive() bool { return v.ж.KeepAlive } +func (v NodeView) MachineAuthorized() bool { return v.ж.MachineAuthorized } +func (v NodeView) Capabilities() []string { return v.ж.Capabilities } +func (v NodeView) ComputedName() string { return v.ж.ComputedName } +func (v NodeView) computedHostIfDifferent() string { return v.ж.computedHostIfDifferent } +func (v NodeView) ComputedNameWithHost() string { return v.ж.ComputedNameWithHost } + +// 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 NodeKey + KeyExpiry time.Time + Machine key.MachinePublic + DiscoKey DiscoKey + Addresses []netaddr.IPPrefix + AllowedIPs []netaddr.IPPrefix + Endpoints []string + DERP string + Hostinfo Hostinfo + Created time.Time + PrimaryRoutes []netaddr.IPPrefix + LastSeen *time.Time + Online *bool + KeepAlive bool + MachineAuthorized bool + Capabilities []string + ComputedName string + computedHostIfDifferent string + ComputedNameWithHost string +}{}) + +// View makes a readonly view of Hostinfo. +func (src *Hostinfo) View() HostinfoView { + return HostinfoView{src} +} + +// HostinfoView is a readonly view of Hostinfo. +type HostinfoView struct{ ж *Hostinfo } + +func (v HostinfoView) Valid() bool { return v.ж != 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) Package() string { return v.ж.Package } +func (v HostinfoView) DeviceModel() string { return v.ж.DeviceModel } +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) GoArch() string { return v.ж.GoArch } +func (v HostinfoView) RoutableIPs() []netaddr.IPPrefix { return v.ж.RoutableIPs } +func (v HostinfoView) RequestTags() []string { return v.ж.RequestTags } +func (v HostinfoView) Services() []Service { return v.ж.Services } +func (v HostinfoView) NetInfo() NetInfoView { return v.ж.NetInfo.View() } + +// 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 + Package string + DeviceModel string + Hostname string + ShieldsUp bool + ShareeNode bool + GoArch string + RoutableIPs []netaddr.IPPrefix + RequestTags []string + Services []Service + NetInfo *NetInfo +}{}) + +// View makes a readonly view of DNSConfig. +func (src *DNSConfig) View() DNSConfigView { + return DNSConfigView{src} +} + +// DNSConfigView is a readonly view of DNSConfig. +type DNSConfigView struct{ ж *DNSConfig } + +func (v DNSConfigView) Valid() bool { return v.ж != nil } + +type _DNSConfigView_Resolvers []dnstype.Resolver + +func (s _DNSConfigView_Resolvers) Len() int { return len(s) } +func (s _DNSConfigView_Resolvers) At(i int) dnstype.ResolverView { return s[i].View() } +func (v DNSConfigView) Resolvers() interface { + Len() int + At(int) dnstype.ResolverView +} { + return _DNSConfigView_Resolvers(v.ж.Resolvers) +} + +type _DNSConfigView_FallbackResolvers []dnstype.Resolver + +func (s _DNSConfigView_FallbackResolvers) Len() int { return len(s) } +func (s _DNSConfigView_FallbackResolvers) At(i int) dnstype.ResolverView { return s[i].View() } +func (v DNSConfigView) FallbackResolvers() interface { + Len() int + At(int) dnstype.ResolverView +} { + return _DNSConfigView_FallbackResolvers(v.ж.FallbackResolvers) +} +func (v DNSConfigView) Domains() []string { return v.ж.Domains } +func (v DNSConfigView) Proxied() bool { return v.ж.Proxied } +func (v DNSConfigView) Nameservers() []netaddr.IP { return v.ж.Nameservers } +func (v DNSConfigView) PerDomain() bool { return v.ж.PerDomain } +func (v DNSConfigView) CertDomains() []string { return v.ж.CertDomains } +func (v DNSConfigView) ExtraRecords() []DNSRecord { return v.ж.ExtraRecords } + +// 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 []netaddr.IP + PerDomain bool + CertDomains []string + ExtraRecords []DNSRecord +}{}) + +// View makes a readonly view of NetInfo. +func (src *NetInfo) View() NetInfoView { + return NetInfoView{src} +} + +// NetInfoView is a readonly view of NetInfo. +type NetInfoView struct{ ж *NetInfo } + +func (v NetInfoView) Valid() bool { return v.ж != 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) WorkingUDP() opt.Bool { return v.ж.WorkingUDP } +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 } + +// 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 + WorkingUDP opt.Bool + HavePortMap bool + UPnP opt.Bool + PMP opt.Bool + PCP opt.Bool + PreferredDERP int + LinkType string + DERPLatency map[string]float64 +}{}) + +// View makes a readonly view of DERPMap. +func (src *DERPMap) View() DERPMapView { + return DERPMapView{src} +} + +// DERPMapView is a readonly view of DERPMap. +type DERPMapView struct{ ж *DERPMap } + +func (v DERPMapView) Valid() bool { return v.ж != nil } +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 { + Regions map[int]*DERPRegion + OmitDefaultRegions bool +}{}) |
