summaryrefslogtreecommitdiffhomepage
path: root/types/opt
AgeCommit message (Collapse)AuthorFilesLines
2025-02-27all: statically enforce json/v2 interface satisfaction (#15154)Joe Tsai1-0/+5
The json/v2 prototype is still in flux and the API can/will change. Statically enforce that types implementing the v2 methods satisfy the correct interface so that changes to the signature can be statically detected by the compiler. Updates tailscale/corp#791 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2025-02-27go.mod: bump github.com/go-json-experiment/json (#15010)Joe Tsai1-8/+8
The upstream module has seen significant work making the v1 emulation layer a high fidelity re-implementation of v1 "encoding/json". This addresses several upstream breaking changes: * MarshalJSONV2 renamed as MarshalJSONTo * UnmarshalJSONV2 renamed as UnmarshalJSONFrom * Options argument removed from MarshalJSONV2 * Options argument removed from UnmarshalJSONV2 Updates tailscale/corp#791 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2024-12-16types/opt: fix test to be agnostic to omitzero support (#14401)Joe Tsai1-1/+10
The omitzero tag option has been backported to v1 "encoding/json" from the "encoding/json/v2" prototype and will land in Go1.24. Until we fully upgrade to Go1.24, adjust the test to be agnostic to which version of Go someone is using. Updates tailscale/corp#25406 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2024-10-30util/syspolicy/setting: make setting.RawItem JSON-marshallableNick Khyl1-1/+1
We add setting.RawValue, a new type that facilitates unmarshalling JSON numbers and arrays as uint64 and []string (instead of float64 and []any) for policy setting values. We then use it to make setting.RawItem JSON-marshallable and update the tests. Updates #12687 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-08-26types/opt: add BoolFlag for setting Bool value as a flagWill Norris2-0/+63
Updates tailscale/corp#22578 Signed-off-by: Will Norris <will@tailscale.com>
2024-07-19types/opt: add (Value[T]).GetOr(def T) T methodNick Khyl1-0/+8
Updates #12736 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-08types/opt: add generic Value[T any] for optional values of any typesNick Khyl2-0/+418
Updates #12736 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2023-12-18ipn: apply tailnet-wide default for auto-updates (#10508)Andrew Lytvynov1-0/+6
When auto-update setting in local Prefs is unset, apply the tailnet default value from control. This only happens once, when we apply the default (or when the user manually overrides it), tailnet default no longer affects the node. Updates #16244 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-08-29types/opt: use switch in Bool.UnmarshalJSON (#9140)Joe Tsai2-13/+15
The compiler does indeed perform this optimization. Updates #cleanup Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2023-01-27all: update copyright and license headersWill Norris2-6/+4
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2022-09-29all: fix spelling mistakesJosh Soref1-1/+1
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-08-09types/opt: support an explicit "unset" value for BoolBrad Fitzpatrick2-15/+55
Updates #4843 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-17all: use any instead of interface{}Josh Bleecher Snyder2-2/+2
My favorite part of generics. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-10-03types/opt: implement Bool.ScanDavid Crawshaw1-0/+26
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-07-15control/{controlknobs,controlclient}: simplify knobs API, fix controlclient ↵Brad Fitzpatrick2-30/+0
crash From integration tests elsewhere: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x845c9b] goroutine 226 [running]: tailscale.com/control/controlclient.(*Direct).sendMapRequest(0xc00053e1e0, 0x16670f0, 0xc000353780, 0xffffffffffffffff, 0xc0003e5f10, 0x0, 0x0) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:803 +0x19bb tailscale.com/control/controlclient.(*Direct).PollNetMap(...) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:574 tailscale.com/control/controlclient.(*Auto).mapRoutine(0xc00052a1e0) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:464 +0x571 created by tailscale.com/control/controlclient.(*Auto).Start /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:151 +0x65 exit status 2 Also remove types/opt.Bool API addition which is now unnecessary. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-15net/portmapper: add upnp port mappingjulianknodt2-0/+30
Add in UPnP portmapping, using goupnp library in order to get the UPnP client and run the portmapping functions. This rips out anywhere where UPnP used to be in portmapping, and has a flow separate from PMP and PCP. RELNOTE=portmapper now supports UPnP mappings Fixes #682 Updates #2109 Signed-off-by: julianknodt <julianknodt@gmail.com>
2020-06-25types/opt: add Bool.EqualBool methodBrad Fitzpatrick2-0/+30
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-27types/opt: add opt package for a new opt.Bool JSON typeBrad Fitzpatrick2-0/+134
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>