mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
types/dnstype: use viewer instead of cloner
This was missed when I did the initial viewer work. Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
57275a4912
commit
a029989aff
@ -5,7 +5,7 @@
|
|||||||
// Package dnstype defines types for working with DNS.
|
// Package dnstype defines types for working with DNS.
|
||||||
package dnstype
|
package dnstype
|
||||||
|
|
||||||
//go:generate go run tailscale.com/cmd/cloner --type=Resolver --clonefunc=true
|
//go:generate go run tailscale.com/cmd/viewer --type=Resolver --clonefunc=true
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Code generated by tailscale.com/util/codegen (viewer); DO NOT EDIT.
|
// Code generated by tailscale/cmd/viewer; DO NOT EDIT.
|
||||||
|
|
||||||
package dnstype
|
package dnstype
|
||||||
|
|
||||||
@ -15,14 +15,18 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run tailscale.com/cmd/cloner -clonefunc=true -type=Resolver
|
//go:generate go run tailscale.com/cmd/cloner -clonefunc=true -type=Resolver
|
||||||
|
|
||||||
// View returns a readonly view of Resolver.
|
// View returns a readonly view of Resolver.
|
||||||
func (p *Resolver) View() ResolverView {
|
func (p *Resolver) View() ResolverView {
|
||||||
return ResolverView{ж: p}
|
return ResolverView{ж: p}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolverView provides a read-only view on Resolver.
|
// ResolverView provides a read-only view over Resolver.
|
||||||
// It's methods should only be called if `Valid()` returns true.
|
//
|
||||||
|
// Its methods should only be called if `Valid()` returns true.
|
||||||
type ResolverView struct {
|
type ResolverView 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
|
// 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.
|
// to callers. You must not let callers be able to mutate it.
|
||||||
ж *Resolver
|
ж *Resolver
|
||||||
@ -34,7 +38,7 @@ func (v ResolverView) Valid() bool { return v.ж != nil }
|
|||||||
// AsStruct returns a clone of the underlying value which aliases no memory with
|
// AsStruct returns a clone of the underlying value which aliases no memory with
|
||||||
// the original.
|
// the original.
|
||||||
func (v ResolverView) AsStruct() *Resolver {
|
func (v ResolverView) AsStruct() *Resolver {
|
||||||
if v.ж != nil {
|
if v.ж == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return v.ж.Clone()
|
return v.ж.Clone()
|
||||||
|
Loading…
Reference in New Issue
Block a user