MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / ParsePreference

Function ParsePreference

resolver/prefer.go:33–46  ·  view source on GitHub ↗
(p string)

Source from the content-addressed store, hash-verified

31}
32
33func ParsePreference(p string) (Preference, error) {
34 var res Preference
35 switch lp := strings.ToLower(p); lp {
36 case "none", "nothing", "any", "anything":
37 res = PreferenceNothing
38 case "ipv4", "ip4", "v4", "4":
39 res = PreferenceIPv4
40 case "ipv6", "ip6", "v6", "6":
41 res = PreferenceIPv6
42 default:
43 return 0, fmt.Errorf("unknown preference specification %q", p)
44 }
45 return res, nil
46}
47
48func boolToInt(x bool) int {
49 if x {

Callers 1

SetMethod · 0.92

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected