/doxyproxy

A client lib for querying DoxyProxy reverse proxy's API. Obtain the true clients IP address

Primary LanguageGoApache License 2.0Apache-2.0

DoxyProxy Client Lib

Go report card Build Status GoDoc Maintenance License GitHub release GitHub issues PRs Welcome

This is a client lib for DoxyProxy.

DoxyProxy is a fast layer 4 reverse proxy supporting both; UDP and TCP. The key features of DoxyProxy is the built in API which allows the remote origin to access the clients true IP address, instead of the proxy's IP.

  • Enhance security
  • Hide your origin
  • Protect your self origin for DDOS attacks

DoxyProxy is built for flexibility and speed, not just in raw performance but also in setup. Use a simple json file to configure a ProxiedHost. Features include:

  • Limit connections per IP
  • DualStack lookup
  • Domain support
  • IPv4, IPv6
  • Configurable IP version switching handled by the proxy
  • Force IPv6 or IPv4 (or allow all)
  • Fail over IP
  • Blacklist IP addresses
  • Blacklist CIDRs (ip ranges)
  • Whitelist IP addresses
  • Whitelist CIDRs (ip ranges)

Install

go get github.com/syrinsecurity/doxyproxy

Examples

package main

import (
	"fmt"
	"net"

	"github.com/syrinsecurity/doxyproxy"
)

var proxy = doxyproxy.New("http://example.com:port/", "appName", "key goes here")

func main() {

	//Standard server, could be anything; http, RTC, gRPC, tcp/udp etc
	l, err := net.Listen("tcp", ":80")
	...
	conn, err := l.Accept()
	...
	//This will remove the IP from the cache once this function closes
	defer proxy.Purge(conn.RemoteAddr())

	//This will resolve the proxies address and obtain the true visitors IP address
	realIP, err := proxy.Resolve(conn.RemoteAddr())
	if err != nil {
		fmt.Println(err)
		realIP = conn.RemoteAddr().String()
	}

	fmt.Println(realIP)
	...
}

Kill the connection from the remote proxy

package main

import (
	"fmt"
	"net"
	
	"github.com/syrinsecurity/doxyproxy"
)

var proxy = doxyproxy.New("http://example.com:port/", "appName", "key goes here")

func main() {

	//Standard server, could be anything; http, RTC, gRPC, tcp/udp etc
	l, err := net.Listen("tcp", ":80")
	...
	conn, err := l.Accept()
	...
	//This will remove the IP from the cache once this function closes
	defer proxy.Purge(conn.RemoteAddr())


	//This will kill the connection from the proxy
	err := proxy.Kill(conn.RemoteAddr())
	if err != nil {
		fmt.Println(err)
	}

	//It is good practise to still close the connection straight after
	conn.Close()

	...
}