Created
March 31, 2018 00:57
-
-
Save jviveiros/5acd88d5a61c5e61a52fe7170957d3ef to your computer and use it in GitHub Desktop.
Go Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import ( | |
"fmt" | |
"gopkg.in/resty.v0" | |
"os" | |
) | |
var username = os.Getenv("FORWARD_HTTP_PROXY_USERNAME") | |
var password = os.Getenv("FORWARD_HTTP_PROXY_PASSWORD") | |
var forward_proxy = os.Getenv("FORWARD_HTTP_PROXY_HOST") | |
var reverse_proxy = os.Getenv("REVERSE_HTTP_PROXY_HOST") | |
func reveal_via_forward_proxy(tokenized_data string) string { | |
url := fmt.Sprintf("https://%s:%s@%s", username, password, forward_proxy) | |
resp, _ := resty. | |
SetProxy(url). | |
SetRootCertificate("./cert.pem"). | |
R(). | |
SetHeader("Content-type", "application/json"). | |
SetHeader("VGS-Log-Request", "all"). | |
SetBody(tokenized_data). | |
//SetResult(&Data{}). | |
SetResult(map[string]string{}). | |
Post("https://httpbin.verygoodsecurity.io/post") | |
result := *resp.Result().(*map[string]string) | |
return fmt.Sprint(result["data"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment