()
| 45 | ) |
| 46 | |
| 47 | func main() { |
| 48 | flag.Parse() |
| 49 | |
| 50 | allCheck() |
| 51 | |
| 52 | if *fPow { |
| 53 | *fDomains = "dev" |
| 54 | *fDir = "~/.pow" |
| 55 | } |
| 56 | |
| 57 | domains := strings.Split(*fDomains, ":") |
| 58 | sort.Sort(ByDecreasingTLDComplexity(domains)) |
| 59 | |
| 60 | if *fCleanup { |
| 61 | dev.Cleanup() |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | if *fUninstall { |
| 66 | onlyDeleteNowUntrustedCertAndKeyInProductionPathFunc := dev.Uninstall(LaunchAgentDirPath, domains) |
| 67 | // FIXME: As part of running tests interactively on macOS, we can't delete .cert/.key |
| 68 | // generated as part of test runs. But, we don't want to leave untrusted .cert/.key's |
| 69 | // hanging around post-uninstall. So, we delete them as part of the main codepath but |
| 70 | // ignore this returned func during testing. Eventually, when the cert/key can be |
| 71 | // stored in the macOS keychain, we can rely on that to avoid this. |
| 72 | onlyDeleteNowUntrustedCertAndKeyInProductionPathFunc() |
| 73 | return |
| 74 | } |
| 75 | |
| 76 | if *fInstall { |
| 77 | err := dev.InstallIntoSystem(&dev.InstallIntoSystemArgs{ |
| 78 | ApplinkDirPath: *fDir, |
| 79 | Domains: *fDomains, |
| 80 | LaunchAgentDirPath: LaunchAgentDirPath, |
| 81 | ListenPort: *fInstallPort, |
| 82 | LogfilePath: LogFilePath, |
| 83 | Timeout: (*fTimeout).String(), |
| 84 | TlsPort: *fInstallTLS, |
| 85 | NoServePublicPaths: *fNoServePublicPaths, |
| 86 | }) |
| 87 | |
| 88 | if err != nil { |
| 89 | log.Fatalf("Unable to install into system: %s", err) |
| 90 | } |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | if *fSetup { |
| 95 | err := dev.Setup() |
| 96 | if err != nil { |
| 97 | log.Fatalf("Unable to configure OS X resolver: %s", err) |
| 98 | } |
| 99 | return |
| 100 | } |
| 101 | |
| 102 | if *fStop { |
| 103 | err := dev.Stop() |
| 104 | if err != nil { |
nothing calls this directly
no test coverage detected