Skip to content

Commit 00c082f

Browse files
committed
v0.3 update to print source ip and port. Also provided build script
1 parent 6248a37 commit 00c082f

4 files changed

Lines changed: 40 additions & 40 deletions

File tree

README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ A proxy that upgrades HTTP connections to HTTPS for systems which cannot make HT
33

44
## Running the proxy
55

6+
Download the latest binary corresponding to your platfrom from the [releases section](https://github.com/yeokm1/http-to-https-proxy/releases/).
7+
68
### Default Configuration
79

810
```bash
@@ -36,38 +38,4 @@ If the server you are connecting to is using expired/insecure TLS certificates.
3638

3739
# Compiling
3840

39-
Just install the latest Go compiler for your platform. The latest at the time of writing is `1.20.2`. THe following was compiled on windows/amd64 platform using Powershell
40-
41-
```bash
42-
$env:GOOS="windows"
43-
$env:GOARCH="amd64"
44-
go build http-to-https-proxy.go
45-
46-
$env:GOOS="windows"
47-
$env:GOARCH="386"
48-
go build http-to-https-proxy.go
49-
50-
$env:GOOS="darwin"
51-
$env:GOARCH="amd64"
52-
go build http-to-https-proxy.go
53-
54-
$env:GOOS="darwin"
55-
$env:GOARCH="arm64"
56-
go build http-to-https-proxy.go
57-
58-
$env:GOOS="linux"
59-
$env:GOARCH="amd64"
60-
go build http-to-https-proxy.go
61-
62-
$env:GOOS="linux"
63-
$env:GOARCH="arm"
64-
go build http-to-https-proxy.go
65-
66-
$env:GOOS="linux"
67-
$env:GOARCH="arm64"
68-
go build http-to-https-proxy.go
69-
70-
$env:GOOS="linux"
71-
$env:GOARCH="riscv64"
72-
go build http-to-https-proxy.go
73-
```
41+
Just install the latest Go compiler for your platform. The latest at the time of writing is `1.20.5`. THe following was compiled on windows/amd64 platform using Powershell script `build.ps1`.

build.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
$env:GOOS="darwin"
2+
$env:GOARCH="amd64"
3+
go build -o http-to-https-proxy-darwin-amd64
4+
5+
$env:GOOS="darwin"
6+
$env:GOARCH="arm64"
7+
go build -o http-to-https-proxy-darwin-arm64
8+
9+
$env:GOOS="linux"
10+
$env:GOARCH="amd64"
11+
go build -o http-to-https-proxy-linux-amd64
12+
13+
$env:GOOS="linux"
14+
$env:GOARCH="arm"
15+
go build -o http-to-https-proxy-linux-arm
16+
17+
$env:GOOS="linux"
18+
$env:GOARCH="arm64"
19+
go build -o http-to-https-proxy-linux-arm64
20+
21+
$env:GOOS="windows"
22+
$env:GOARCH="386"
23+
go build -o http-to-https-proxy-win-386.exe
24+
25+
$env:GOOS="windows"
26+
$env:GOARCH="amd64"
27+
go build -o http-to-https-proxy-win-amd64.exe

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module http-to-https-proxy
2+
3+
go 1.20

http-to-https-proxy.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strconv"
1111
)
1212

13-
var versionCode = "v0.2"
13+
var versionCode = "v0.3"
1414
var proxyBufferSize = 4096
1515
var httpListenPort = 80
1616
var httpsConnectingPort = 443
@@ -20,7 +20,9 @@ func handler(responseToRequest http.ResponseWriter, incomingRequest *http.Reques
2020

2121
host := incomingRequest.Host
2222
url := incomingRequest.URL
23-
log.Printf("Received request to route to host %s and url %s", host, url)
23+
remote := incomingRequest.RemoteAddr
24+
25+
log.Printf("Request from %s to host %s and url %s", remote, host, url)
2426

2527
// Get the raw request bytes
2628
requestDump, err := httputil.DumpRequest(incomingRequest, true)
@@ -111,7 +113,7 @@ func main() {
111113
argsWithoutProg := os.Args[1:]
112114

113115
for _, arg := range os.Args[1:] {
114-
if arg == "-i"{
116+
if arg == "-i" {
115117
allowInsecure = true
116118
}
117119
}
@@ -144,11 +146,11 @@ func main() {
144146
}
145147

146148
log.Printf("HTTP to HTTPS proxy %s listening to %d, forward to %d with listening buffer %d", versionCode, httpListenPort, httpsConnectingPort, proxyBufferSize)
147-
149+
148150
if allowInsecure {
149151
log.Printf("Allow insecure TLS certificates")
150152
}
151-
153+
152154
log.Printf("You can supply the listening port, forward port, buffer size, insecure -i cert as command line args")
153155

154156
http.HandleFunc("/", handler)

0 commit comments

Comments
 (0)