Documentation
¶
Overview ¶
Package platformsetup separates installation history, executable-scoped rule inspection, and rule writes. None of them asserts actual ICE reachability.
Index ¶
- Constants
- Variables
- type Choice
- type FilePreferences
- type Finding
- type InboundAction
- type Network
- type Operation
- type OperationState
- type Platform
- type Preference
- type Preferences
- type Profile
- type ProfilePolicy
- type Protocol
- type Reason
- type Report
- type Rule
- type RuleAction
- type RuleStatus
- type Service
- type Setting
- type Snapshot
- type StartupDecision
- type StartupReport
Constants ¶
const CheckTimeout = 8 * time.Second
const InspectionScope = "executable-inbound-rules"
InspectionScope excludes all-program rules; even RulePresent is not evidence that the host's complete effective policy allows this executable.
const PreferenceEnvironment = "WINDSHARE_NETWORK_PREFERENCE"
const PreferenceFileName = "network-preference.json"
Variables ¶
var ErrUnsupported = errors.New("network setup is unsupported on this platform")
Functions ¶
This section is empty.
Types ¶
type FilePreferences ¶
type FilePreferences struct{ Path string }
func (FilePreferences) Load ¶
func (store FilePreferences) Load() (Preference, error)
func (FilePreferences) Save ¶
func (store FilePreferences) Save(preference Preference) error
type Finding ¶
type Finding struct {
Network Network
Protocol Protocol
Status RuleStatus
Reason Reason
Rules []Rule
}
func Evaluate ¶
Evaluate reports the configuration observed within InspectionScope. It does not attempt to resolve arbitrary address ranges, ports, IPsec, or global rules.
func (Finding) SuggestSetup ¶
type InboundAction ¶
type InboundAction uint8
const ( UnknownAction InboundAction = iota Allow Block )
func (InboundAction) String ¶
func (v InboundAction) String() string
type Operation ¶
type Operation struct {
State OperationState `json:"state"`
Detail string `json:"detail,omitempty"`
}
type OperationState ¶
type OperationState string
const ( RulesApplied OperationState = "applied" RulesRemoved OperationState = "removed" AuthorizationDeclined OperationState = "authorization-declined" PermissionRequired OperationState = "permission-required" OperationFailed OperationState = "failed" OperationUnsupported OperationState = "unsupported" )
type Preference ¶
Configure records a completed rule write for one installation, not live policy. Skip belongs to the user and deliberately has no installation identity.
func (Preference) Valid ¶
func (p Preference) Valid() bool
type Preferences ¶
type Preferences interface {
Load() (Preference, error)
Save(Preference) error
}
type ProfilePolicy ¶
type Report ¶
type Report struct {
Executable string
Preference Preference
PreferenceError string
InspectionError string
Findings []Finding
}
func (Report) SuggestSetup ¶
type Rule ¶
type Rule struct {
Name string
Profiles []Profile
Protocol Protocol
Action InboundAction
Local bool
Conditional bool
Restrictions string
}
The adapter selects explicit executable paths. Restricted rules are retained for diagnosis without attempting to evaluate their arbitrary traffic selectors.
type RuleStatus ¶
type RuleStatus uint8
const ( UnknownStatus RuleStatus = iota RulePresent RuleMissing RuleRestricted PolicyRestricted RuleNotRequired )
func (RuleStatus) String ¶
func (v RuleStatus) String() string
type Service ¶
type Service struct {
Platform Platform
Preferences Preferences
Executable func() (string, error) // Canonical installation path used by rule ownership.
}
func (*Service) Setup ¶
func (service *Service) Setup(ctx context.Context, action RuleAction, allowElevation bool) (Operation, Report)
Explicit setup always inspects current executable rules, even after a failed operation. A successful write records installation history, not reachability.
func (*Service) Startup ¶
func (service *Service) Startup() StartupReport
func (*Service) SupportsSetup ¶
SupportsSetup reports whether Setup can apply host firewall rules for this installation. Non-Windows hosts return false through ErrUnsupported.
type Setting ¶
type Setting uint8
Setting preserves missing evidence instead of silently interpreting it as false.
type Snapshot ¶
type Snapshot struct {
Networks []Network
Profiles []ProfilePolicy
Rules []Rule
}
type StartupDecision ¶
type StartupDecision uint8
StartupDecision describes installation history only. It never claims a current firewall verdict, so ordinary transfers need no system-policy query.
const ( SetupUnchosen StartupDecision = iota + 1 SetupSkipped SetupRecorded SetupPathChanged SetupReadFailed SetupUnsupported )
func (StartupDecision) String ¶
func (v StartupDecision) String() string
func (StartupDecision) SuggestSetup ¶
func (v StartupDecision) SuggestSetup() bool
func (StartupDecision) Valid ¶
func (v StartupDecision) Valid() bool
type StartupReport ¶
type StartupReport struct {
Decision StartupDecision
Executable string
ConfiguredExecutable string
Error string
}