-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysproxy_other.go
More file actions
35 lines (27 loc) · 1.34 KB
/
Copy pathsysproxy_other.go
File metadata and controls
35 lines (27 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//go:build !linux && !darwin && !windows
package sysproxy
import (
"context"
"fmt"
"runtime"
)
// errUnsupported wraps ErrUnsupportedPlatform with the current GOOS so callers
// can use errors.Is while still getting a specific message.
func setUser(_ string) error { return errUnsupported() }
func unsetUser() error { return errUnsupported() }
func setUserPAC(_ string) error { return errUnsupported() }
func setUserMulti(_ ProxyConfig) error { return errUnsupported() }
// otherBackend implements globalBackend for unsupported operating systems.
type otherBackend struct{}
func (otherBackend) SetGlobal(_ context.Context, _ *proxy) error { return errUnsupported() }
func (otherBackend) UnsetGlobal(_ context.Context) error { return errUnsupported() }
func (otherBackend) GetGlobal(_ context.Context) (string, error) { return "", errUnsupported() }
func (otherBackend) GetGlobalConfig(_ context.Context) (ProxyConfig, error) {
return ProxyConfig{}, errUnsupported()
}
func (otherBackend) SetGlobalPAC(_ context.Context, _ string) error { return errUnsupported() }
func (otherBackend) SetGlobalMulti(_ context.Context, _ ProxyConfig) error { return errUnsupported() }
func init() { activeBackend = otherBackend{} }
func errUnsupported() error {
return fmt.Errorf("%w %q", ErrUnsupportedPlatform, runtime.GOOS)
}