Add linux support
This commit is contained in:
parent
fd31f87045
commit
0d87e2deae
7 changed files with 40 additions and 20 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -30,7 +30,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
rm -rf ./out
|
rm -rf ./out
|
||||||
./build.sh linux server
|
./build.sh linux server
|
||||||
# ./build.sh linux desktop - Linux desktop build is not currently supported.
|
./build.sh linux desktop
|
||||||
- name: Upload Build Artifact
|
- name: Upload Build Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -11,11 +11,16 @@
|
||||||
|
|
||||||
A simple proxy server created by [@NBTX](https://github.com/NBTX/) for [Postwoman](https://github.com/liyasthomas/postwoman/) and hosted by [Apollo Software](https://apollosoftware.xyz/).
|
A simple proxy server created by [@NBTX](https://github.com/NBTX/) for [Postwoman](https://github.com/liyasthomas/postwoman/) and hosted by [Apollo Software](https://apollosoftware.xyz/).
|
||||||
|
|
||||||
|
## Installation 📦
|
||||||
|
**Proxywoman require `zenity` on Linux. This is available in most distribution package managers.**
|
||||||
|
|
||||||
|
We're still working on automated installers. For now, copy the binary to a user-writeable location and launch the application.
|
||||||
|
A dialog will open and explain the certificate installation process - there are more detailed instructions in our [wiki](https://github.com/postwoman-io/proxywoman/wiki).
|
||||||
|
|
||||||
## Demo 🚀
|
## Demo 🚀
|
||||||
[https://postwoman.io](https://postwoman.io)
|
[https://postwoman.io](https://postwoman.io)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Building 🏗️
|
## Building 🏗️
|
||||||
|
|
||||||
*These are bash scripts. In order to execute them on Windows, you will need to use some form of bash shell on Windows. We recommend [Git Bash](https://gitforwindows.org/).*
|
*These are bash scripts. In order to execute them on Windows, you will need to use some form of bash shell on Windows. We recommend [Git Bash](https://gitforwindows.org/).*
|
||||||
|
|
1
build.sh
1
build.sh
|
@ -171,7 +171,6 @@ elif [ "$PLATFORM" = "windows" ]; then
|
||||||
# zip -r "Proxywoman-Windows-v${VERSION_NAME}.zip" "Proxywoman-Windows-v${VERSION_NAME}.exe"
|
# zip -r "Proxywoman-Windows-v${VERSION_NAME}.zip" "Proxywoman-Windows-v${VERSION_NAME}.exe"
|
||||||
# cd "$WORKING_DIR" || exit 1
|
# cd "$WORKING_DIR" || exit 1
|
||||||
elif [ "$PLATFORM" = "linux" ]; then
|
elif [ "$PLATFORM" = "linux" ]; then
|
||||||
echo "NOTICE: Proxywoman is untested and currently unsupported on Linux."
|
|
||||||
GOOS="linux" GO111MODULE=on go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxywoman-Linux-v${VERSION_NAME}"
|
GOOS="linux" GO111MODULE=on go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "$OUTPUT_DIR/Proxywoman-Linux-v${VERSION_NAME}"
|
||||||
|
|
||||||
# Compressing output binaries
|
# Compressing output binaries
|
||||||
|
|
|
@ -74,31 +74,37 @@ func CreateKeyPair() *[2]bytes.Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
func EnsurePrivateKeyInstalled () error {
|
func EnsurePrivateKeyInstalled () error {
|
||||||
_, err := os.Stat(GetDataPath() + "/cert.pem");
|
_, err := os.Stat(GetOrCreateDataPath() + "/cert.pem");
|
||||||
_, err = os.Stat(GetDataPath() + "/key.pem");
|
_, err = os.Stat(GetOrCreateDataPath() + "/key.pem");
|
||||||
|
|
||||||
// If the error is that the file does not exist, create the file
|
// If the error is that the file does not exist, create the file
|
||||||
// and then return no error (unless one was thrown in the process of creating the key.)
|
// and then return no error (unless one was thrown in the process of creating the key.)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
encodedPEM := CreateKeyPair();
|
encodedPEM := CreateKeyPair();
|
||||||
err = ioutil.WriteFile(GetDataPath() + "/cert.pem", encodedPEM[0].Bytes(), 0600);
|
err = ioutil.WriteFile(GetOrCreateDataPath() + "/cert.pem", encodedPEM[0].Bytes(), 0600);
|
||||||
err = ioutil.WriteFile(GetDataPath() + "/key.pem", encodedPEM[1].Bytes(), 0600);
|
err = ioutil.WriteFile(GetOrCreateDataPath() + "/key.pem", encodedPEM[1].Bytes(), 0600);
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// Windows doesn't recognize .pem as certificates, but we can simply write the PEM data
|
// Windows doesn't recognize .pem as certificates, but we can simply write the PEM data
|
||||||
// into a .cer file and it works just fine!
|
// into a .cer file and it works just fine!
|
||||||
err = ioutil.WriteFile(GetDataPath() + "/cert.cer", encodedPEM[0].Bytes(), 0600);
|
err = ioutil.WriteFile(GetOrCreateDataPath() + "/cert.cer", encodedPEM[0].Bytes(), 0600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
_ = exec.Command("open", GetDataPath()).Run();
|
_ = exec.Command("open", GetOrCreateDataPath()).Run();
|
||||||
_, _ = dlgs.Warning("Proxywoman", "Proxywoman needs you to install a root certificate authority (cert.pem).\nPlease double-click the certificate file to open it in Keychain Access and follow the installation and trust process.\n\nFor more information about this process and why it's required, please click the Postwoman icon in the status tray and select 'Help'.\n\nClick OK when you have installed the certificate and marked it as trusted.");
|
_, err = dlgs.Warning("Proxywoman", "Proxywoman needs you to install a root certificate authority (cert.pem).\nPlease double-click the certificate file to open it in Keychain Access and follow the installation and trust process.\n\nFor more information about this process and why it's required, please click the Postwoman icon in the status tray and select 'Help'.\n\nClick OK when you have installed the certificate and marked it as trusted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
_ = exec.Command("explorer.exe", GetDataPath() + string(os.PathSeparator) + "cert.cer").Run();
|
_ = exec.Command("explorer.exe", GetOrCreateDataPath()+string(os.PathSeparator)+"cert.cer").Run();
|
||||||
_, _ = dlgs.Warning("Proxywoman", "Proxywoman needs you to install a root certificate authority (cert.cer).\nPlease install the certificate (opened) into the 'Trusted Root Certification Authorities' store for the Local Machine.\n\nFor more information about this process and why it's required, please click the Postwoman icon in the system tray and select 'Help'.\n\nClick OK when you have installed the certificate and marked it as trusted.");
|
_, err = dlgs.Warning("Proxywoman", "Proxywoman needs you to install a root certificate authority (cert.cer).\nPlease install the certificate (opened) into the 'Trusted Root Certification Authorities' store for the Local Machine.\n\nFor more information about this process and why it's required, please click the Postwoman icon in the system tray and select 'Help'.\n\nClick OK when you have installed the certificate and marked it as trusted.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
_ = exec.Command("xdg-open", GetOrCreateDataPath()).Run();
|
||||||
|
_, err = dlgs.Warning("Proxywoman", "Proxywoman needs you to install a root certificate authority (cert.pem).\n[INSTRUCTIONS PENDING]\n\nFor more information about this process and why it's required, please click the Postwoman icon in the status tray and select 'Help'.\n\nClick OK when you have installed the certificate and marked it as trusted.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -108,7 +114,16 @@ func EnsurePrivateKeyInstalled () error {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDataPath() string {
|
func GetOrCreateDataPath() string {
|
||||||
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]));
|
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]));
|
||||||
return dir + string(os.PathSeparator) + "data";
|
|
||||||
|
dataDir := dir + string(os.PathSeparator) + "data";
|
||||||
|
|
||||||
|
// If the data directory stat fails because the direcotry does not exist,
|
||||||
|
// create the data directory.
|
||||||
|
if _, err := os.Stat(dataDir); os.IsNotExist(err) {
|
||||||
|
_ = os.Mkdir(dataDir, 0700);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataDir;
|
||||||
}
|
}
|
|
@ -67,11 +67,12 @@ func Initialize(
|
||||||
|
|
||||||
err := EnsurePrivateKeyInstalled();
|
err := EnsurePrivateKeyInstalled();
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err.Error());
|
||||||
onStatusChange("An error occurred.", false);
|
onStatusChange("An error occurred.", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
httpServerError := http.ListenAndServeTLS(proxyURL, GetDataPath() + "/cert.pem", GetDataPath() + "/key.pem", nil);
|
httpServerError := http.ListenAndServeTLS(proxyURL, GetOrCreateDataPath() + "/cert.pem", GetOrCreateDataPath() + "/key.pem", nil);
|
||||||
|
|
||||||
if httpServerError != nil {
|
if httpServerError != nil {
|
||||||
onStatusChange("An error occurred.", false);
|
onStatusChange("An error occurred.", false);
|
||||||
|
|
0
stale_outputs_checked
Normal file
0
stale_outputs_checked
Normal file
|
@ -1,3 +1,3 @@
|
||||||
# Version Information
|
# Version Information
|
||||||
VERSION_NAME=0.0.2
|
VERSION_NAME=0.0.3
|
||||||
VERSION_CODE=2
|
VERSION_CODE=3
|
||||||
|
|
Loading…
Reference in a new issue