MCPcopy Create free account
hub / github.com/ddev/ddev / wsl2Environment

Function wsl2Environment

pkg/environment/environment.go:39–56  ·  view source on GitHub ↗

wsl2Environment returns the specific WSL2 environment type by calling GetWSL2NetworkingMode once. nat is the common case; others are unusual.

()

Source from the content-addressed store, hash-verified

37// wsl2Environment returns the specific WSL2 environment type by calling
38// GetWSL2NetworkingMode once. nat is the common case; others are unusual.
39func wsl2Environment() string {
40 mode, err := nodeps.GetWSL2NetworkingMode()
41 if err != nil {
42 return DDEVEnvironmentWSL2
43 }
44 switch mode {
45 case "mirrored":
46 return DDEVEnvironmentWSL2Mirrored
47 case "virtioproxy":
48 return DDEVEnvironmentWSL2VirtioProxy
49 case "none":
50 return DDEVEnvironmentWSL2None
51 case "bridged":
52 return DDEVEnvironmentWSL2Bridged
53 default: // "nat" is the normal case
54 return DDEVEnvironmentWSL2
55 }
56}
57
58// IsWSL2Environment returns true for any DDEV environment string that represents a WSL2 mode.
59func IsWSL2Environment(envType string) bool {

Callers 1

GetDDEVEnvironmentFunction · 0.85

Calls 1

GetWSL2NetworkingModeFunction · 0.92

Tested by

no test coverage detected