An encrypted HTTP server

Overview

goflyway v2 - a local port forwarder built on HTTP

master is the active develop branch and containing v2 code, for the stable v1 release (though it was once called v2.0), please refer to v1.0 branch.

goflyway v2 is a special tool to forward local ports to a remote server securly, just like ssh -L.

goflyway uses pure HTTP POST requests to relay TCP connections. There is no CONNECT involved nor needed because goflyway is designed mainly for those people who are behind a CONNECT-less HTTP proxy or want to accelerate connections through static CDNs.

However pure HTTP requesting is definitely a waste of bandwidth if you already have a better network environment, so use -w to turn on WebSocket relay, or -K to turn on KCP relay if possible.

Usage

Forward localhost:1080 to server:1080 through server:80

    Server: ./goflyway :80
    Client: ./goflyway -L 1080::1080 server:80 -p password

Forward localhost:1080 to server2:1080 through server:80 using WebSocket

    Server: ./goflyway :80
    Client: ./goflyway -w -L 1080:server2:1080 server:80 -p password

Dynamically forward localhost:1080 to server:80

    Server: ./goflyway :80
    Client: ./goflyway -D 1080 server:80 -p password

HTTP reverse proxy or static file server on the same port:

    ./goflyway :80 -P http://127.0.0.1:8080 
    ./goflyway :80 -P /var/www/html

Write Buffer

In HTTP mode when server received some data it can't just send them to the client directly because HTTP is not bi-directional, instead the server must wait until the client requests them, which means these data will be stored in memory for some time.

You can use -W bytes to limit the maximum bytes a server can buffer (for each connection), by default it is 1048576 (1M). If the buffer reaches the limit, the following bytes will be blocked until the buffer has free space for them.

Comments
  • 翻不了墙啊

    翻不了墙啊

    hi.

    [email protected]:~# lsof -i:8100 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME goflyway 18202 root 3u IPv6 28152319 0t0 TCP *:8100 (LISTEN) [email protected]:~# 可见服务器端运行正常。

    本地机器: yudeMacBook-Air:downloads brite$ ./goflyway -up=my-vps-ip:8100 -k=my-key // __ _
    /.
    .\ / | |
    \ / / __ _ ___ | |
    | |_ ___ ____ _ _ _ '__/ \ / ' |/ _ | | | | | \ \ /\ / / ' | | | | - ) | (| | () | | | | || |\ V V / (| | || | _/ _, |_/|| ||_, | _/_/ _,|_, | || / | / | / | " " cf |/ |/ |_/

    [ 0930 10:12:53.071] listening on :8100, upstream is my-vps-ip:8100

    怎么翻不了墙啊?

    macos 
    opened by luckypoem 45
  • 疑似ssl证书问题

    疑似ssl证书问题

    系统版本 win10 pro,goflyway版本1.2.0a/1.1.0a,之前都使用正常,直到昨天重新全新安装了win10 pro。发现goflyway不正常,google,youtube无法访问,在chrome里提示ERR_CONNECTION_CLOSED,在firefox则是提示服务器响应时间过长,ca.pem已导入了中间证书后,仍然无法正常。 同时注意到,如果是无ssl证书的地址如www.wenxuecity.com,则可以通过goflyway代理正常访问。

    opened by falltree 15
  • 1.2.0 a version android can't global proxy

    1.2.0 a version android can't global proxy

    I used Git updated and compiled source code rather than apk.

    But all apps can't through proxy access Internet except broswer is working.

    [E0408/093110.460:httpmux.go(40)] prefetch err: read 127.0.0.1:59351, i/o timeout [E0408/093110.571:client.go(314)] dial 127.0.0.1:443, C111, getsockopt: connection refused ... 1 similar message(s) [E0408/093155.318:io.go(83)] bridge 13s: read 127.0.0.1:59368, C104, read: connection reset by peer ... 5 similar message(s) ... 1 similar message(s) [E0408/093158.878:client.go(314)] dial 127.0.0.1:443, C111, getsockopt: connection refused

    opened by fudingyu 11
  • 用编译后的版本,无法连接

    用编译后的版本,无法连接

    在vps上和Windows上分别安装编译后的程序,并启动了程序, [[email protected] goflyway]# ./goflyway // __ _
    /.
    .\ / | |
    \ / / __ _ ___ | |
    | |_ ___ ____ _ _ _ '__/ \ / ' |/ _ | | | | | \ \ /\ / / ' | | | | - ) | (| | () | | | | || |\ V V / (| | || | _/ _, |_/|| ||_, | _/_/ _,|_, | || / | / | / | " " cf |/ |/ |_/

    [WARNING] you are using the default key (-k key) listening on :8100

    浏览器设置为http代理 127.0.0.1:8100

    可是上不了网 无法访问此网站

    网址为 https://www.google.com/ 的网页可能暂时无法连接,或者它已永久性地移动到了新网址。 ERR_TUNNEL_CONNECTION_FAILED

    opened by flyingwhitewhale 11
  • 无法使用IPv4连接

    无法使用IPv4连接

    下载最新版本,在服务器上启动 goflyway

    [email protected]:~/goflyway# git log -1
    commit 745a86d00a75d7e94d45409f87ff9e10c92cce07
    Author: coyove <[email protected]>
    Date:   Wed Sep 13 15:34:17 2017 +0800
    
        Directories cleanup
    [email protected]:~/goflyway# go run main.go -k=mykey -debug
         __//                   __ _                           
        /.__.\                 / _| |                          
        \ \/ /      __ _  ___ | |_| |_   ___      ____ _ _   _ 
     '__/    \     / _' |/ _ \|  _| | | | \ \ /\ / / _' | | | |
      \-      )   | (_| | (_) | | | | |_| |\ V  V / (_| | |_| |
       \_____/     \__, |\___/|_| |_|\__, | \_/\_/ \__,_|\__, |
     ____|_|____    __/ |             __/ |               __/ |
         " "  cf   |___/             |___/               |___/ 
     
    [  0913 20:42:16.480] debug mode on, port 8100 for http proxy, port 8101 for socks5 proxy
    [  0913 20:42:16.480] listening on :8102
    [  0913 20:42:16.480] socks5 proxy at :8101
    [  0913 20:42:16.480] http proxy at :8100, upstream is 127.0.0.1:8102
    

    发现监听端口只有 tcp6 的,没有 IPv4

    [email protected]:~# netstat -nlp | grep main
    tcp6       0      0 :::8100                 :::*                    LISTEN      3495/main       
    tcp6       0      0 :::8101                 :::*                    LISTEN      3495/main       
    tcp6       0      0 :::8102                 :::*                    LISTEN      3495/main       
    
    opened by huzhifeng 10
  • failed to read ACL config    err:open chinalist.txt:the system can not find the file specified

    failed to read ACL config err:open chinalist.txt:the system can not find the file specified

    现象:windows端同时开2个goflyway进程,连接相同的服务器IP和端口,一个进程为全局,另一个进程指定本地ACL规则文件,都可以正常使用,是不是goflyway windows客户并不支持多个进程这种使用方式呢?io错误是不是本地IP到VPS IP之间丢包造成的?

    进程1-全局错误: failed to read ACL config (并未指定ACL文件,见后面的进程1配置) err:open chinalist.txt:the system can not find the file specified i/o timeout

    进程2-ACL错误: i/o timeout

    环境:windows 10 pro 1709 16299 X64 浏览器:Chrome X64 服务端:v1.1.0 alpha 客户端:v1.1.0 alpha 客户端进程1:CreateObject("WScript.Shell").Run "P:\GoFlyWayBWG\goflyway.exe -g -k=pw -up=myip:1300 -l=:8200 -web-port=8201",0 客户端进程2:CreateObject("WScript.Shell").Run "P:\GoFlyWayBWG\goflyway.exe -k=pw -up=myip:1300 -l=:8300 -web-port=8301 -acl P:\GoFlyWayBWG\nobanAD.acl",0

    default

    acl

    opened by yyysuo 9
  • 我在ubuntu的客户端运行一段时间后自动关闭,第一版似乎没那么容易关。以后更新每次我都重新编译,但是没有一次能坚持一天。

    我在ubuntu的客户端运行一段时间后自动关闭,第一版似乎没那么容易关。以后更新每次我都重新编译,但是没有一次能坚持一天。

    服务端倒是没有自动关闭。我查看了log发现如下 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x4743f9]

    goroutine 58029 [running]: panic(0x709a80, 0xc4200120a0) /usr/local/go/src/runtime/panic.go:500 +0x1a1 github.com/coyove/goflyway/proxy.(*prefetchReader).readTimeout.func1(0xc422b014b0, 0xc422b014c0, 0xc4218de400, 0xc421434340, 0x1, 0x1, 0xc4225fe770) /home/sky/work/soft/go/src/github.com/coyove/goflyway/proxy/multiplexer.go:28 +0x29 created by github.com/coyove/goflyway/proxy.(*prefetchReader).readTimeout /home/sky/work/soft/go/src/github.com/coyove/goflyway/proxy/multiplexer.go:30 +0x106

    opened by loveproe 8
  • (arm version) DNS lookup failed: read udp: read: connection refused

    (arm version) DNS lookup failed: read udp: read: connection refused

    version fa7eda0, with ignore_local_dns ON go build arm version cmd: ./gof -up="cf://$$:80" -k="$$" -l=":8100" -web-port="8101" -lv=dbg -g -U=http firefox -> SwitchyOmega -> gof:socks5 Errror only occurs in arm version. Linux x86 and windows are all good.

    UTC,main.go:266, INFO ,goflyway devel main.go:277, WARNING ,Failed to read ACL config: open chinalist.txt: no such file or directory main.go:435, INFO ,Upstream config: cf://$$:80 main.go:308, INFO ,Global proxy enabled main.go:415, INFO ,Client fb16884 started: you->0.0.0.0:8100->cloudflare->$$:80 main.go:411, INFO ,Web console started at 127.0.0.1:8101 acl.go:42, INFO ,ACL check result: unknown >> 7 ## I added acl.go:42 to print the debug info acl.go:43, ERROR ,ACL check error: DNS lookup failed: lookup google.com on [::1]:53: read udp [::1]:39998->[::1]:53: read: connection refused ## this is the original acl.go:42 debug print client.go:538, LOG ,Global - google.com:80 client.go:541, ERROR ,"Dial failed: dial, lookup $$ on [::1]:53: read udp [::1]:38258->[::1]:53: read: connection refused" ......

    Is it because of the -g option or ignore_dns flag? Thanks for any clue about this.

    opened by binus 5
  • 自己修改的goflyway安卓版,支持CDN

    自己修改的goflyway安卓版,支持CDN

    如题,参考:Kcp_android这个项目,通过修改做了一个goflyway的安卓版,可以通过在wifi里面设置代理直接使用,也可以利用Postern这个软件配合一起使用。Postern代理服务器栏填127.0.0.1,端口栏填goflyway上面填写的本地端口号(纯端口号,不要带上ip)。

    软件下载地址: https://github.com/koolwiki/goflyway_android/files/2173352/goflyway_v1.0.apk.zip

    android 
    opened by koolwiki 5
  • 还是Ipv6问题

    还是Ipv6问题

    一台机器好几个IPv6。比如: 2607:f0d0:1003:1::11 2607:f0d0:1003:1::12 2607:f0d0:1003:1::13 等,但是访问的时候,显示的IPv6地址,总是最后添加的一个。 比如:-up="[2607:f0d0:1003:1::11]:80" 但是显示的地址是: 2607:f0d0:1003:1::13

    这种是正常的吗?

    opened by gaoyuoppa 4
  • invalid websocket response: 522 Origin Connection Time-out

    invalid websocket response: 522 Origin Connection Time-out

    **use cloudflare before server. port ~8000,http mode but got error when check connecting to bing.com: so where is broken in the connection path? (server? CF -> server? or me -> CF?) ** (use $ symbol hide private info)

    client.go:394, ERROR ,"Dial failed: invalid websocket response from bing.com:443: HTTP/1.1 522 Origin Connection Time-out Date: Sun, $ Nov 2018 $$:$$:$$ GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=$$$; expires=$-Nov-19 $$:$$:$$ GMT; path=/; domain=$$$; HttpOnly Set-Cookie: cf_use_ob=0; path=/; expires=$-Nov-18 $$:$$:$$ GMT Expires: Thu, 01 Jan 1970 00:00:01 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Server: cloudflare CF-RAY: $$$

    opened by binus 4
  • MAC升级新版后程序打不开了

    MAC升级新版后程序打不开了

    MAC今天升级了12.6,然后程序打不开了 请问有知道原因的朋友吗?是不是go版本不对了?要重新编译还是如何来修复?先谢谢了

    fatal error: runtime: bsdthread_register error

    runtime stack: runtime.throw(0x14a5f74, 0x21) /usr/local/go/src/runtime/panic.go:616 +0x81 fp=0x7ff7bfeff828 sp=0x7ff7bfeff808 pc=0x1029001 runtime.goenvs() /usr/local/go/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff858 sp=0x7ff7bfeff828 pc=0x1026b83 runtime.schedinit() /usr/local/go/src/runtime/proc.go:501 +0xd6 fp=0x7ff7bfeff8c0 sp=0x7ff7bfeff858 pc=0x102b8f6 runtime.rt0_go(0x7ff7bfeff8f0, 0x1, 0x7ff7bfeff8f0, 0x1000000, 0x1, 0x7ff7bfeffa40, 0x0, 0x7ff7bfeffa49, 0x7ff7bfeffa65, 0x7ff7bfeffa75, ...) /usr/local/go/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff8c8 sp=0x7ff7bfeff8c0 pc=0x1051464

    opened by leomsn 0
  • 用了CF加速最近一直闪退,一开就退

    用了CF加速最近一直闪退,一开就退

    用了CF CDN加速的,基本一直闪退,没有用CDN加速就没事 报错如下: panic: runtime error: slice bounds out of range

    goroutine 318 [running]: github.com/coyove/goflyway/proxy.(*io_t).Copy(0x1286a140, 0x332f0030, 0x12a0e320 , 0x330a50b0, 0x127f4c80, 0x35ca7f25, 0x9081bd0c, 0x9a590d93, 0xde6126bb, 0x0, . ..) /var/www/golib/src/github.com/coyove/goflyway/proxy/io.go:258 +0x8a7 github.com/coyove/goflyway/proxy.(*io_t).Bridge.func1(0x1286a140, 0x859fe0, 0x12 a0e320, 0x85a0e0, 0x127f4c80, 0x35ca7f25, 0x9081bd0c, 0x9a590d93, 0xde6126bb, 0x 12954600, ...) /var/www/golib/src/github.com/coyove/goflyway/proxy/io.go:67 +0x9b created by github.com/coyove/goflyway/proxy.(*io_t).Bridge /var/www/golib/src/github.com/coyove/goflyway/proxy/io.go:66 +0x103

    opened by linsan970809 1
  • v2.0.0 rc1版本报错:Failed to decrypt host

    v2.0.0 rc1版本报错:Failed to decrypt host

    服务器ubuntu18.04 服务端配置 ./goflyway -l :62082 -k "pwdxxx" -U udp -lv dbg

    客户端windows10 客户端配置 ./goflyway -up "cf://45.77.xx.xxx:62082" -l 62082 -k "pwdxxx" -U udp -lv dbg

    错误log 2020-06-05 06:17:03.276 UTC,server.go:228, DEBUG ,Invalid request from 113.16.xxx.xxx: wu_v+0n_nnAj+2l8D4s1vzizmj_v5Ap71iw-oDg37xCn0xvEt4y01xzyApg3thlE4?3.ux.zxE8j8DyFguxkzDog59k_nyqvE21um9noyli5junkFl 2020-06-05 06:17:03.890 UTC,util.go:419, ERROR ,"Failed to decrypt host: wzDpAB6+xlqvtrA9Ax931z3pEDFl?owFBkiB0321ijl-4gzlp2yrstCy_5C47i_B_jtlswlyCD5oo5=wlBv+5266Au49vyz3zguFtnCpo749, cipher: message authentication failed"

    1.3.0a版本正常

    opened by zhengoogle 1
Releases(v2.0.0rc1-caddy)
Owner
Coyove
Man's reach, exceeds his imagination
Coyove
An anonymous, encrypted Point-to-Point (Layer 3) tunnel between two peers.

NKN-Link An anonymous, encrypted Point-to-Point (Layer 3) tunnel between two peers. NKN-Link Table of Contents Preface Description Install Setup Run P

HAH! Sun 8 Dec 20, 2022
Go-http-sleep: Delayed response http server, useful for testing various timeout issue for application running behind proxy

delayed response http server, useful for testing various timeout issue for application running behind proxy

guessi 0 Jan 22, 2022
Echo-server - An HTTP echo server designed for testing applications and proxies

echo-server An HTTP echo server designed for testing applications and proxies. R

Erik Cavalcanti 6 Dec 20, 2022
“Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server!

Dear Port80 About The Project: “Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server! +---------------------

Abbas Gheydi 6 Jun 29, 2022
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Aliaksandr Valialkin 18.9k Jan 5, 2023
Go HTTP tunnel is a reverse tunnel based on HTTP/2.

Go HTTP tunnel is a reverse tunnel based on HTTP/2. It enables you to share your localhost when you don't have a public IP.

Michal Jan Matczuk 3k Dec 28, 2022
Simple GUI to convert Charles headers to golang's default http client (net/http)

Charles-to-Go Simple GUI to convert Charles headers to golang's default http client (net/http) Usage Compile code to a binary, go build -ldflags -H=wi

null 0 Dec 14, 2021
Http-logging-proxy - A HTTP Logging Proxy For Golang

http-logging-proxy HTTP Logging Proxy Description This project builds a simple r

null 3 Aug 1, 2022
Http-recorder - Application for record http response as static files

http-recorder This is a application for record http response as static files. Th

null 1 Mar 21, 2022
httpstream provides HTTP handlers for simultaneous streaming uploads and downloads of objects, as well as persistence and a standalone server.

httpfstream httpfstream provides HTTP handlers for simultaneous streaming uploads and downloads of files, as well as persistence and a standalone serv

Sourcegraph 16 May 1, 2021
Executing shell commands via HTTP server

shell2http HTTP-server to execute shell commands. Designed for development, prototyping or remote control. Settings through two command line arguments

Sergey Mudrik 1k Jan 1, 2023
HTTP cache server, such as varnish

pike 与varnish类似的HTTP缓存服务器,主要的特性如下: 提供WEB的管理配置界面,简单易上手 支持br与gzip两种压缩方式,根据客户端自动选择。对于可缓存与不可缓存请求使用不同的压缩配置,更佳的时间与空间的平衡 仅基于Cache-Control生成缓存有效期,接口缓存完全由接口开发者

Tree Xie 166 Dec 17, 2022
Lightweight network boot/install server (DHCP, TFTP, HTTP)

netbootd netbootd is a lightweight network boot server, designed for maximum flexibility and with "batteries included" approach in mind, serving as a

Daniel Speichert 173 Dec 22, 2022
Simple, secure and modern Go HTTP server to serve static sites, single-page applications or a file with ease

srv srv is a simple, secure and modern HTTP server, written in Go, to serve static sites, single-page applications or a file with ease. You can use it

Kevin Pollet 55 Sep 7, 2022
Smocker is a simple and efficient HTTP mock server and proxy.

Smocker (server mock) is a simple and efficient HTTP mock server. The documentation is available on smocker.dev. Table of contents Installation With D

Thibaut Rousseau 902 Jan 7, 2023
golang http server wrapper

Yong Simple Web Framework This project benchmarked gin-gonic. Installation Go command to install Yong. $ go get -u github.com/rladyd818/yong Import it

null 5 May 12, 2021
A http proxy server chaining a upstream which needs authentication headers.

Normalize HTTP Proxy A http proxy server chaining a upstream which needs authentication headers. local -> [np] -> upstream -> destination Usage Norma

LOGI 15 Dec 14, 2022