Movatterモバイル変換


[0]ホーム

URL:


policyclient

package
v1.92.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:4Imported by:0

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package policyclient contains the minimal syspolicy interface as needed byclient code using syspolicy. It's the part that's always linked in, even if the restof syspolicy is omitted from the build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcRegisterClientImpl

func RegisterClientImpl(cClient)

RegisterClientImpl registers aClient implementation to be returned byGet.

Types

typeClient

type Client interface {// GetString returns a string policy setting with the specified key,// or defaultValue (and a nil error) if it does not exist.GetString(keypkey.Key, defaultValuestring) (string,error)// GetStringArray returns a string array policy setting with the specified key,// or defaultValue (and a nil error) if it does not exist.GetStringArray(keypkey.Key, defaultValue []string) ([]string,error)// GetBoolean returns a boolean policy setting with the specified key,// or defaultValue (and a nil error) if it does not exist.GetBoolean(keypkey.Key, defaultValuebool) (bool,error)// GetUint64 returns a numeric policy setting with the specified key,// or defaultValue (and a nil error) if it does not exist.GetUint64(keypkey.Key, defaultValueuint64) (uint64,error)// GetDuration loads a policy from the registry that can be managed by an// enterprise policy management system and describes a duration for some// action. The registry value should be a string that time.ParseDuration// understands. If the registry value is "" or can not be processed,// defaultValue (and a nil error) is returned instead.GetDuration(keypkey.Key, defaultValuetime.Duration) (time.Duration,error)// GetPreferenceOption loads a policy from the registry that can be// managed by an enterprise policy management system and allows administrative// overrides of users' choices in a way that we do not want tailcontrol to have// the authority to set. It describes user-decides/always/never options, where// "always" and "never" remove the user's ability to make a selection. If not// present or set to a different value, defaultValue (and a nil error) is returned.GetPreferenceOption(keypkey.Key, defaultValueptype.PreferenceOption) (ptype.PreferenceOption,error)// GetVisibility returns whether a UI element should be visible based on// the system's configuration.// If unconfigured, implementations should return [ptype.VisibleByPolicy]// and a nil error.GetVisibility(keypkey.Key) (ptype.Visibility,error)// SetDebugLoggingEnabled enables or disables debug logging for the policy client.SetDebugLoggingEnabled(enabledbool)// HasAnyOf returns whether at least one of the specified policy settings is// configured, or an error if no keys are provided or the check fails.HasAnyOf(keys ...pkey.Key) (bool,error)// RegisterChangeCallback registers a callback function that will be called// whenever a policy change is detected. It returns a function to unregister// the callback and an error if the registration fails.RegisterChangeCallback(cb func(PolicyChange)) (unregister func(), errerror)}

Client is the interface between code making questions about the system policyand the actual implementation.

funcGet

func Get()Client

Get returns a non-nilClient implementation as a function of thebuild tags. It returns a no-op implementation if the full syspolicypackage is omitted from the build, or in tests.

typeNoPolicyClient

type NoPolicyClient struct{}

NoPolicyClient is a no-op implementation ofClient that onlyreturns default values.

func (NoPolicyClient)GetBoolean

func (NoPolicyClient) GetBoolean(keypkey.Key, defaultValuebool) (bool,error)

func (NoPolicyClient)GetDuration

func (NoPolicyClient) GetDuration(namepkey.Key, defaultValuetime.Duration) (time.Duration,error)

func (NoPolicyClient)GetPreferenceOption

func (NoPolicyClient) GetPreferenceOption(namepkey.Key, defaultValueptype.PreferenceOption) (ptype.PreferenceOption,error)

func (NoPolicyClient)GetString

func (NoPolicyClient) GetString(keypkey.Key, defaultValuestring) (string,error)

func (NoPolicyClient)GetStringArray

func (NoPolicyClient) GetStringArray(keypkey.Key, defaultValue []string) ([]string,error)

func (NoPolicyClient)GetUint64

func (NoPolicyClient) GetUint64(keypkey.Key, defaultValueuint64) (uint64,error)

func (NoPolicyClient)GetVisibility

func (NoPolicyClient) GetVisibility(namepkey.Key) (ptype.Visibility,error)

func (NoPolicyClient)HasAnyOf

func (NoPolicyClient) HasAnyOf(keys ...pkey.Key) (bool,error)

func (NoPolicyClient)RegisterChangeCallback

func (NoPolicyClient) RegisterChangeCallback(cb func(PolicyChange)) (unregister func(), errerror)

func (NoPolicyClient)SetDebugLoggingEnabled

func (NoPolicyClient) SetDebugLoggingEnabled(enabledbool)

typePolicyChange

type PolicyChange interface {// HasChanged reports whether the policy setting identified by the given key// has changed.HasChanged(pkey.Key)bool// HasChangedAnyOf reports whether any of the provided policy settings// changed in this change.HasChangedAnyOf(keys ...pkey.Key)bool}

PolicyChange is the interface representing a change in policy settings.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp