glider/README.md

166 lines
4.5 KiB
Markdown
Raw Normal View History

# [glider](https://github.com/nadoo/glider)
[![Go Report Card](https://goreportcard.com/badge/github.com/nadoo/glider?style=flat-square)](https://goreportcard.com/report/github.com/nadoo/glider)
[![GitHub release](https://img.shields.io/github/v/release/nadoo/glider.svg?style=flat-square&include_prereleases)](https://github.com/nadoo/glider/releases)
[![Actions Status](https://img.shields.io/github/workflow/status/nadoo/glider/Build?style=flat-square)](https://github.com/nadoo/glider/actions)
2017-09-03 01:05:56 +08:00
glider is a forward proxy with multiple protocols support, and also a dns forwarding server with ipset management features(like dnsmasq).
2017-07-13 21:55:41 +08:00
2017-09-03 01:05:56 +08:00
we can set up local listeners as proxy servers, and forward requests to internet via forwarders.
2018-08-01 00:47:43 +08:00
```bash
|Forwarder ----------------->|
2017-07-23 01:57:05 +08:00
Listener --> | | Internet
2018-08-01 00:47:43 +08:00
|Forwarder --> Forwarder->...|
2017-07-23 01:57:05 +08:00
```
2017-07-27 01:22:56 +08:00
## Features
2018-08-01 00:47:43 +08:00
2018-01-22 00:40:04 +08:00
Listen (local proxy server):
2018-08-01 00:47:43 +08:00
2018-01-20 23:27:22 +08:00
- Socks5 proxy(tcp&udp)
- Http proxy(tcp)
- SS proxy(tcp&udp)
2017-07-27 01:22:56 +08:00
- Linux transparent proxy(iptables redirect)
- TCP tunnel
2018-01-20 23:27:22 +08:00
- UDP tunnel
2018-01-20 22:13:04 +08:00
- UDP over TCP tunnel
- TLS, use it together with above proxy protocols(tcp)
- Unix domain socket, use it together with above proxy protocols(tcp)
2018-12-12 21:40:31 +08:00
- KCP protocol, use it together with above proxy protocols(tcp)
2017-09-03 01:05:56 +08:00
2018-01-22 00:40:04 +08:00
Forward (local proxy client/upstream proxy server):
2018-08-01 00:47:43 +08:00
2018-01-22 23:24:33 +08:00
- Socks5 proxy(tcp&udp)
2018-01-20 23:27:22 +08:00
- Http proxy(tcp)
- SS proxy(tcp&udp&uot)
2018-05-17 10:16:00 +08:00
- SSR proxy(tcp)
2018-07-05 20:44:19 +08:00
- VMess proxy(tcp)
2020-04-08 01:09:51 +08:00
- Trojan proxy(tcp)
- TLS, use it together with above proxy protocols(tcp)
2018-07-22 20:02:50 +08:00
- Websocket, use it together with above proxy protocols(tcp)
- Unix domain socket, use it together with above proxy protocols(tcp)
2018-12-12 21:40:31 +08:00
- KCP protocol, use it together with above proxy protocols(tcp)
- Simple-Obfs, use it together with above proxy protocols(tcp)
2017-07-27 01:22:56 +08:00
2018-01-22 00:40:04 +08:00
DNS Forwarding Server (udp2tcp):
2018-08-01 00:47:43 +08:00
- DNS Over Proxy
2017-09-03 01:05:56 +08:00
- Listen on UDP and forward dns requests to remote dns server in TCP via forwarders
- Specify different upstream dns server based on destinations(in rule file)
- Tunnel mode: forward to a fixed upstream dns server
- Add resolved IPs to proxy rules
- Add resolved IPs to ipset
2018-08-01 00:47:43 +08:00
- DNS cache
- Custom dns record
2017-09-03 01:05:56 +08:00
2018-09-04 20:26:40 +08:00
IPSet Management (Linux kernel version >= 2.6.32):
2018-08-01 00:47:43 +08:00
2017-09-03 01:05:56 +08:00
- Add ip/cidrs from rule files on startup
- Add resolved ips for domains from rule files by dns forwarding server
2017-09-03 01:05:56 +08:00
2017-07-27 01:22:56 +08:00
General:
2018-08-01 00:47:43 +08:00
- Http and socks5 on the same port
2018-09-04 20:26:40 +08:00
- Forwarder chain
- RR/HA/LHA/DH strategy for multiple forwarders
2017-07-27 01:22:56 +08:00
- Periodical proxy checking
2017-08-31 00:08:22 +08:00
- Rule proxy based on destinations: [Config Examples](config/examples)
2018-08-21 07:57:21 +08:00
- Send requests from specific ip/interface
2017-07-30 10:57:24 +08:00
TODO:
2018-08-01 00:47:43 +08:00
- [ ] IPv6 support in ipset manager
- [ ] Transparent UDP proxy (iptables tproxy)
2018-07-03 00:31:43 +08:00
- [ ] Performance tuning
- [ ] TUN/TAP device support
2018-08-01 00:47:43 +08:00
- [ ] SSH tunnel support (maybe)
2017-07-27 01:22:56 +08:00
2017-07-13 21:55:41 +08:00
## Install
2018-08-01 00:47:43 +08:00
Binary:
2017-07-21 18:58:51 +08:00
- [https://github.com/nadoo/glider/releases](https://github.com/nadoo/glider/releases)
2017-07-13 21:55:41 +08:00
2020-04-08 01:09:51 +08:00
Go Get (requires **Go 1.14+** ):
2018-08-01 00:47:43 +08:00
2017-07-21 18:58:51 +08:00
```bash
go get -u github.com/nadoo/glider
```
2018-08-01 00:47:43 +08:00
ArchLinux:
2017-07-21 18:58:51 +08:00
```bash
sudo pacman -S glider
```
## Run
2018-08-01 00:47:43 +08:00
2020-04-08 01:09:51 +08:00
help:
2017-07-21 18:58:51 +08:00
```bash
2020-04-08 01:09:51 +08:00
glider -h
2017-07-21 18:58:51 +08:00
```
2020-04-08 01:09:51 +08:00
run:
2017-07-21 18:58:51 +08:00
```bash
2020-04-08 01:09:51 +08:00
glider -verbose -listen :8443 -forward SCHEME://HOST:PORT
2017-07-21 18:58:51 +08:00
```
2017-07-29 18:15:22 +08:00
```bash
2020-04-08 01:09:51 +08:00
glider -config CONFIGPATH
2017-07-29 18:15:22 +08:00
```
2017-07-13 21:55:41 +08:00
```bash
2020-04-08 01:09:51 +08:00
glider -config CONFIGPATH -listen :8080 -verbose
2017-07-13 21:55:41 +08:00
```
2020-04-08 01:09:51 +08:00
## Config
2018-08-01 00:47:43 +08:00
2017-09-03 01:05:56 +08:00
- [ConfigFile](config)
- [glider.conf.example](config/glider.conf.example)
- [office.rule.example](config/rules.d/office.rule.example)
- [Examples](config/examples)
2017-09-04 00:21:12 +08:00
- [transparent proxy with dnsmasq](config/examples/8.transparent_proxy_with_dnsmasq)
- [transparent proxy without dnsmasq](config/examples/9.transparent_proxy_without_dnsmasq)
2020-04-08 01:09:51 +08:00
## Proxy & Protocol Chain
2018-12-14 00:02:25 +08:00
In glider, you can easily chain several proxy servers or protocols together, e.g:
- Chain proxy servers:
```bash
forward=http://1.1.1.1:80,socks5://2.2.2.2:1080,ss://method:pass@3.3.3.3:8443@
```
- Chain protocols: https proxy (http over tls)
```bash
forward=tls://1.1.1.1:443,http://
```
- Chain protocols: vmess over ws over tls
```bash
forward=tls://1.1.1.1:443,ws://,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2
```
- Chain protocols and servers:
``` bash
forward=socks5://1.1.1.1:1080,tls://2.2.2.2:443,ws://,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2
```
- Chain protocols in listener: https proxy server
``` bash
listen=tls://:443?cert=crtFilePath&key=keyFilePath,http://
```
2017-07-13 21:55:41 +08:00
## Service
2018-08-01 00:47:43 +08:00
- systemd: [https://github.com/nadoo/glider/blob/master/systemd/](https://github.com/nadoo/glider/blob/master/systemd/)
2017-07-14 11:20:02 +08:00
2017-07-18 19:45:35 +08:00
## Links
2018-08-01 00:47:43 +08:00
2017-07-21 18:58:51 +08:00
- [conflag](https://github.com/nadoo/conflag): command line and config file parse support
2017-07-23 01:46:06 +08:00
- [ArchLinux](https://www.archlinux.org/packages/community/x86_64/glider): a great linux distribution with glider pre-built package