do it both in and out
This commit is contained in:
6
Makefile
6
Makefile
@ -105,7 +105,11 @@ gendoc: all
|
||||
@cat USAGE.md
|
||||
|
||||
docker-build:
|
||||
docker build --force-rm --build-arg user=$(eephttpd) --build-arg path=example/www -f Dockerfile -t eyedeekay/$(eephttpd) .
|
||||
docker build --force-rm \
|
||||
--build-arg user=$(eephttpd) \
|
||||
--build-arg path=example/www \
|
||||
-f Dockerfile \
|
||||
-t eyedeekay/$(eephttpd) .
|
||||
|
||||
docker-volume:
|
||||
docker run -i -t -d \
|
||||
|
@ -179,12 +179,12 @@ TLS configuration is experimental. It might not be possible(To multiplex http
|
||||
and https on the same SAM tunnel).
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluV+GcACgkQ11wDs5te
|
||||
FOFVkQf5Ac9bAq2Mq01OksDG/B3yVB6uqN4mWj3a7QKgFjUdfjv0N73X/M/IoTqI
|
||||
vlCkTS0CM4u3C+ndOVL2P9C7Cj//pYuC+a2K/3JDkc+x35jCEMN6hItAWF859+Lk
|
||||
kgFAGnlpwGv0C4l/WgL6P7dyHOnBBYLM4TK5L6soxdjaxLrMzQigaF9JadIN7DlT
|
||||
UjIJpW/ivx+luAbswUI59pbB+byEG98Wlht6E24b7R/WnAodFRQhO5vgKpVCNmW/
|
||||
2HQqYn/XgV8v1YhfnWolzIbG93RA0f5vEtIkq7kyz4rggu8sZIrK2ma09mbzymkf
|
||||
Jiow7DJoPCFG59qCg1aSC+ZoeSAD+w==
|
||||
=um1i
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluWAasACgkQ11wDs5te
|
||||
FOF3EAf/dvmHkpQIz9eWgSghQWRybIDFJUJkARlkNQLJInwD4AgCI9lKRogiJohy
|
||||
qw71dNUOgFMRSNGihjSh/ND40GBC3HCVsaqm/+DG1Z9zmNaCEvSvJ+bEXDUZTeUf
|
||||
kGwf7MUoAaVWwPJ4wwHOeq36bfjVHWN65l/ILEptghiHfxDJl4/9N7BMOns2QCuo
|
||||
gXu2nEhmYv9d6+wEYoJOCycVzqIs9CuDX4U5aTyv7/sS3zrup4CzIQH9GEe5ePkG
|
||||
dVC+rRRjULv2ctUzXiUqrNg8X4w2y9U7518TUTy+3O1RGtz7AfGz33DtOy0PvXpt
|
||||
CencJ8WhYFmMYJ4fU/m98p9xp3M3+w==
|
||||
=arTa
|
||||
-----END PGP SIGNATURE-----
|
||||
|
23
forwarder.go
23
forwarder.go
@ -137,9 +137,30 @@ func (f *SAMForwarder) forward (conn *sam3.SAMConn) { //(conn net.Conn) {
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
if f.Type == "http" {
|
||||
request, err = http.ReadRequest(bufio.NewReader(conn))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
dest := conn.RemoteAddr().(sam3.I2PAddr)
|
||||
log.Println("Adding headers to http connection", dest.Base64(), dest.Base32(), dest.DestHash().String())
|
||||
request.Header.Add("X-I2p-Dest-Base64", dest.Base64())
|
||||
request.Header.Add("X-I2p-Dest-Base32", dest.Base32())
|
||||
request.Header.Add("X-I2p-Dest-Hash", dest.DestHash().String())
|
||||
}
|
||||
defer client.Close()
|
||||
defer conn.Close()
|
||||
io.Copy(conn, client)
|
||||
if f.Type == "http" {
|
||||
if x, e := httputil.DumpRequest(request, true); e != nil {
|
||||
log.Println(string(x))
|
||||
client.Write(x)
|
||||
}else{
|
||||
log.Println(e.Error())
|
||||
io.Copy(conn, client)
|
||||
}else{
|
||||
io.Copy(conn, client)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user