cdn2proxy

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2021 License: GPL-3.0 Imports: 13 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-cdn2proxy

proxy your traffic through CDN using websocket

what does it do

  • you can use this as a library in your project: go get -v -u github.com/jm33-m0/go-cdn2proxy
  • simply put, go-cdn2proxy forwards your traffic through websocket, which can be implemented behind most CDNs
  • anything that supports socks5 proxy can use go-cdn2proxy

for me, i wrote this for emp3r0r

example

server
package main

import (
    "log"

    cdn2proxy "github.com/jm33-m0/go-cdn2proxy"
)

func main() {
    err := cdn2proxy.StartServer("9000", "127.0.0.1:8000", os.Stderr)
    if err != nil {
        log.Fatal(err)
    }
}
client
package main

import (
    "log"

    cdn2proxy "github.com/jm33-m0/go-cdn2proxy"
)

func main() {
    err := cdn2proxy.StartProxy("127.0.0.1:10888", "wss://example.com/ws", "socks5://127.0.0.1:1080", "https://9.9.9.9/dns-query")
    if err != nil {
        log.Fatal(err)
    }
}

thanks

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DestAddr = "127.0.0.1:8000"
)

use this logger

Functions

func Socks5Auth

func Socks5Auth(client net.Conn) (err error)

func StartProxy

func StartProxy(addr, wsurl, proxy, doh string) error

StartProxy on client side, start a socks5 proxy url: websocket server. eg: wss://example.com/path/to/ws use wss instead of ws since your reverse proxy (nginx, Cloudflare) should be using TLS addr: local proxy address, used as agent's outgoing proxy proxy: proxy for websocket connection, if you cannot directly connect to ws server, use this eg. socks5://127.0.0.1:1080 doh: DNS over HTTPS server, eg. https://9.9.9.9/dns-query, prevent DNS leaks

func StartServer

func StartServer(port, destAddr, wspath string, logOutput io.Writer) (err error)

StartServer start websocket server port: listen on 127.0.0.1:port destAddr: send everything here, we only want a single purpose proxy wspath: access this path to reach ws service, eg. /ws if you use go-cdn2proxy along with other HTTP server, prevent multiple `/`

Types

This section is empty.

Directories

Path Synopsis
cmd
client command
server command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址