cdn2proxy

package module
v0.0.0-...-4f06be3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: GPL-3.0 Imports: 13 Imported by: 1 module, 0 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 content delivery network (CDN) using WebSocket

What does it do?

  • Use this as a library in your project : go get -v -u github.com/jm33-m0/go-cdn2proxy
  • It forwards your traffic through WebSocket, which can be implemented behind most CDNs
  • Anything that supports SOCKS5 proxy can use go-cdn2proxy

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", "ws", os.Stderr)
    // `ws` is the path to your websocket server
    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")
    // here `/ws` must match the one set in `StartServer`
    if err != nil {
        log.Fatal(err)
    }
}

Many thanks to

Minimal SOCKS5 Proxy Omplementation in Golang

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
⌂ 换网址