wsl2Environment returns the specific WSL2 environment type by calling GetWSL2NetworkingMode once. nat is the common case; others are unusual.
()
| 37 | // wsl2Environment returns the specific WSL2 environment type by calling |
| 38 | // GetWSL2NetworkingMode once. nat is the common case; others are unusual. |
| 39 | func 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. |
| 59 | func IsWSL2Environment(envType string) bool { |
no test coverage detected