fix typo, format

This commit is contained in:
Page Fault
2020-06-22 05:12:36 +00:00
parent b522f3fcee
commit 3ff068ced6
68 changed files with 186 additions and 110 deletions
+1
View File
@@ -2,6 +2,7 @@ package api
import (
"context"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/statistic"
)
+2 -1
View File
@@ -5,12 +5,13 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"github.com/p4gefau1t/trojan-go/api/service"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/option"
"google.golang.org/grpc"
"io"
)
type apiController struct {
+2 -1
View File
@@ -3,6 +3,8 @@ package service
import (
"context"
"fmt"
"net"
"github.com/p4gefau1t/trojan-go/api"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
@@ -10,7 +12,6 @@ import (
"github.com/p4gefau1t/trojan-go/statistic"
"github.com/p4gefau1t/trojan-go/tunnel/trojan"
"google.golang.org/grpc"
"net"
)
type ClientAPI struct {
+3 -2
View File
@@ -3,12 +3,13 @@ package service
import (
"context"
"fmt"
"testing"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/statistic/memory"
"google.golang.org/grpc"
"testing"
"time"
)
func TestClientAPI(t *testing.T) {
+3 -2
View File
@@ -3,6 +3,9 @@ package service
import (
"context"
"fmt"
"io"
"net"
"github.com/p4gefau1t/trojan-go/api"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
@@ -10,8 +13,6 @@ import (
"github.com/p4gefau1t/trojan-go/statistic"
"github.com/p4gefau1t/trojan-go/tunnel/trojan"
"google.golang.org/grpc"
"io"
"net"
)
type ServerAPI struct {
+3 -2
View File
@@ -3,12 +3,13 @@ package service
import (
"context"
"fmt"
"testing"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/statistic/memory"
"google.golang.org/grpc"
"testing"
"time"
)
func TestServerAPI(t *testing.T) {
+1
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"crypto/rand"
"testing"
"v2ray.com/core/common"
)
@@ -10,7 +10,7 @@ Trojan-Go允许高级用户自定义协议栈。在自定义模式下,Trojan-G
- 在一层TLS上再建立一层或更多层TLS加密
- 使用TLS传输Websocket流量,在Websocket层上再建立一层TLS,在第二层TLS上再使用AEAD进行传输
- 使用TLS传输Websocket流量,在Websocket层上再建立一层TLS,在第二层TLS上再使用Shadowsocks AEAD进行加密传输
- 在TCP连接上,使用Shadowsocks的AEAD加密传输Trojan协议
+20 -9
View File
@@ -22,7 +22,7 @@ weight: 30
其余未填的选项,用下面给出的值进行填充。
*Trojan-Go支持对人类更友好的YAML语法,配置文件的基本结构与JSON相同,效果等价。不过为了遵守YAML的命名习惯,你需要把下划线("_")转换为横杠("-"),如```remote_addr```在YAML文件中为```remote-addr```*
*Trojan-Go支持对人类更友好的YAML语法,配置文件的基本结构与JSON相同,效果等价。但是为了遵守YAML的命名习惯,你需要把下划线("_")转换为横杠("-"),如```remote_addr```在YAML文件中为```remote-addr```*
```json
{
@@ -44,7 +44,6 @@ weight: 30
"key": *required*,
"key_password": "",
"cipher": "",
"cipher_tls13": "",
"curves": "",
"prefer_server_cipher": false,
"sni": "",
@@ -56,12 +55,12 @@ weight: 30
"plain_http_response": "",
"fallback_addr": "",
"fallback_port": 0,
"fingerprint": "firefox",
"fingerprint": "firefox"
},
"tcp": {
"no_delay": true,
"keep_alive": true,
"prefer_ipv4": false,
"prefer_ipv4": false
},
"mux": {
"enabled": false,
@@ -141,7 +140,19 @@ weight: 30
对于server,```local_xxxx```对应trojan服务器监听地址(强烈建议使用443端口),```remote_xxxx```填写识别到非trojan流量时代理到的HTTP服务地址,通常填写本地80端口。
```log_level```指定日志等级。等级越高,输出的信息越少,0输出Debug以上日志(所有日志),1输出Info及以上日志,2输出Warning及以上日志,3输出Error及以上信息,4输出Fatal及以上信息,5完全不输出日志。
```log_level```指定日志等级。等级越高,输出的信息越少。合法的值有
- 0输出Debug以上日志(所有日志)
- 1输出Info及以上日志
- 2输出Warning及以上日志
- 3输出Error及以上日志
- 4输出Fatal及以上日志
- 5完全不输出日志
```log_file```指定日志输出文件路径。如果未指定则使用标准输出。
@@ -179,9 +190,9 @@ weight: 30
```prefer_server_cipher```客户端是否偏好选择服务端在协商中提供的密码学套件。
```cipher```和```cipher13```指TLS使用的密码学套件。只有在你明确知道自己在做什么的情况下,才应该去填写此项以修改trojan-go使用的TLS密码学套件。**正常情况下,你应该将其留空或者不填**,trojan-go会根据当前硬件平台以及远端的情况,自动选择最合适的加密算法以提升性能和安全性。如果需要填写,密码学套件名用分号(":")分隔。Go的TLS库中弃用了TLS1.2中不安全的密码学套件,并完全支持TLS1.3。默认情况下,trojan-go将优先使用更安全的TLS1.3。
```cipher```TLS使用的密码学套件。```cipher13``字段与此字段合并。只有在你明确知道自己在做什么的情况下,才应该去填写此项以修改trojan-go使用的TLS密码学套件。**正常情况下,你应该将其留空或者不填**,trojan-go会根据当前硬件平台以及远端的情况,自动选择最合适的加密算法以提升性能和安全性。如果需要填写,密码学套件名用分号(":")分隔,按优先顺序排列。Go的TLS库中弃用了TLS1.2中部分不安全的密码学套件,并完全支持TLS1.3。默认情况下,trojan-go将优先使用更安全的TLS1.3。
```curves```指定TLS在ECDHE中偏好使用的椭圆曲线。只有你明确知道自己在做什么的情况下,才应该填写此项。曲线名称用分号(":")分隔。
```curves```指定TLS在ECDHE中偏好使用的椭圆曲线。只有你明确知道自己在做什么的情况下,才应该填写此项。曲线名称用分号(":")分隔,按优先顺序排列。
```fingerprint```用于指定TLS Client Hello指纹伪造类型,以抵抗GFW对于TLS Client Hello指纹的特征识别和阻断。trojan-go使用[utls](https://github.com/refraction-networking/utls)进行指纹伪造,默认伪造Firefox的指纹。合法的值有
@@ -321,11 +332,11 @@ trojan-go兼容trojan-gfw的基于mysql的用户管理方式,但更推荐的
```enabled```表示是否启用mysql数据库进行用户验证。
```check_rate```是trojan-go从MySQL获取用户数据,更新缓存的间隔时间,单位是秒。
```check_rate```是trojan-go从MySQL获取用户数据并更新缓存的间隔时间,单位为秒。
其他选项可以顾名思义,不再赘述。
users表结构和trojan-gfw定义一致,下面是一个创建users表的例子。注意这里的password指的是密码经过SHA224散列之后的值(字符串),流量download, upload, quota的单位是字节。你可以通过修改数据库users表中的用户记录的方式,添加和删除用户,或者指定用户的流量配额。trojan-go会根据所有的用户流量配额,自动更新当前有效的用户列表。如果download+upload>quota,trojan-go服务器将拒绝该用户的连接。
users表结构和trojan-gfw版本定义一致,下面是一个创建users表的例子。注意这里的password指的是密码经过SHA224散列之后的值(字符串),流量download, upload, quota的单位是字节。你可以通过修改数据库users表中的用户记录的方式,添加和删除用户,或者指定用户的流量配额。trojan-go会根据所有的用户流量配额,自动更新当前有效的用户列表。如果download+upload>quota,trojan-go服务器将拒绝该用户的连接。
```mysql
CREATE TABLE users (
+2 -1
View File
@@ -3,9 +3,10 @@ package easy
import (
"flag"
"fmt"
"github.com/p4gefau1t/trojan-go/option"
"net"
"github.com/p4gefau1t/trojan-go/option"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/proxy"
+1
View File
@@ -2,6 +2,7 @@ package main
import (
"flag"
"github.com/p4gefau1t/trojan-go/option"
_ "github.com/p4gefau1t/trojan-go/build"
+1
View File
@@ -2,6 +2,7 @@ package client
import (
"context"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/proxy"
"github.com/p4gefau1t/trojan-go/tunnel/adapter"
+1
View File
@@ -2,6 +2,7 @@ package forward
import (
"context"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/proxy"
"github.com/p4gefau1t/trojan-go/proxy/client"
+1
View File
@@ -4,6 +4,7 @@ package nat
import (
"context"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/proxy"
"github.com/p4gefau1t/trojan-go/proxy/client"
+3 -2
View File
@@ -2,11 +2,12 @@ package proxy
import (
"flag"
"io/ioutil"
"strings"
"github.com/p4gefau1t/trojan-go/constant"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/option"
"io/ioutil"
"strings"
)
type Option struct {
+1
View File
@@ -2,6 +2,7 @@ package server
import (
"context"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/proxy"
"github.com/p4gefau1t/trojan-go/proxy/client"
+1
View File
@@ -2,6 +2,7 @@ package proxy
import (
"context"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+2 -1
View File
@@ -2,11 +2,12 @@ package memory
import (
"context"
"github.com/p4gefau1t/trojan-go/log"
"sync"
"sync/atomic"
"time"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/common"
+2 -1
View File
@@ -2,11 +2,12 @@ package statistic
import (
"context"
"github.com/p4gefau1t/trojan-go/log"
"io"
"strings"
"sync"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/common"
)
+2 -1
View File
@@ -2,10 +2,11 @@ package scenario
import (
"fmt"
"testing"
"github.com/p4gefau1t/trojan-go/common"
_ "github.com/p4gefau1t/trojan-go/proxy/custom"
"github.com/p4gefau1t/trojan-go/test/util"
"testing"
)
func TestCustom1(t *testing.T) {
+4 -2
View File
@@ -3,7 +3,6 @@ package scenario
import (
"bytes"
"fmt"
"github.com/p4gefau1t/trojan-go/test/util"
"io/ioutil"
"net"
"net/http"
@@ -11,6 +10,10 @@ import (
"testing"
"time"
"github.com/p4gefau1t/trojan-go/test/util"
_ "net/http/pprof"
"github.com/p4gefau1t/trojan-go/common"
_ "github.com/p4gefau1t/trojan-go/log/golog"
"github.com/p4gefau1t/trojan-go/proxy"
@@ -20,7 +23,6 @@ import (
_ "github.com/p4gefau1t/trojan-go/proxy/server"
_ "github.com/p4gefau1t/trojan-go/statistic/memory"
netproxy "golang.org/x/net/proxy"
_ "net/http/pprof"
)
// test key and cert
+4 -3
View File
@@ -3,15 +3,16 @@ package util
import (
"crypto/rand"
"fmt"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"golang.org/x/net/websocket"
"io"
"io/ioutil"
"net"
"net/http"
"sync"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"golang.org/x/net/websocket"
)
var HTTPAddr string
+1
View File
@@ -2,6 +2,7 @@ package adapter
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
+1
View File
@@ -2,6 +2,7 @@ package adapter
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+2 -1
View File
@@ -2,9 +2,10 @@ package dokodemo
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"net"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+4 -3
View File
@@ -3,12 +3,13 @@ package dokodemo
import (
"context"
"fmt"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"net"
"sync"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
)
func TestDokodemo(t *testing.T) {
+1
View File
@@ -2,6 +2,7 @@ package dokodemo
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+5 -4
View File
@@ -3,15 +3,16 @@ package freedom
import (
"context"
"crypto/tls"
"net"
"net/url"
"strconv"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"golang.org/x/net/proxy"
"net"
"net/url"
"strconv"
"time"
)
type Client struct {
+1
View File
@@ -2,6 +2,7 @@ package freedom
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+5 -4
View File
@@ -4,14 +4,15 @@ import (
"bufio"
"context"
"fmt"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"io/ioutil"
"net"
"net/http"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
)
func TestHTTP(t *testing.T) {
+4 -3
View File
@@ -4,14 +4,15 @@ import (
"bufio"
"context"
"fmt"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"io"
"io/ioutil"
"net"
"net/http"
"strings"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
)
type ConnectConn struct {
+1
View File
@@ -2,6 +2,7 @@ package http
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+1 -1
View File
@@ -171,7 +171,7 @@ func NewClient(ctx context.Context, underlay tunnel.Client) (*Client, error) {
client := &Client{
underlay: underlay,
concurrency: clientConfig.Mux.Concurrency,
timeout: time.Duration(clientConfig.Mux.Timeout) * time.Second,
timeout: time.Duration(clientConfig.Mux.IdleTimeout) * time.Second,
ctx: ctx,
cancel: cancel,
clientPool: make(map[muxID]*smuxClientInfo),
+2 -2
View File
@@ -4,7 +4,7 @@ import "github.com/p4gefau1t/trojan-go/config"
type MuxConfig struct {
Enabled bool `json,yaml:"enabled"`
Timeout int `json,yaml:"timeout"`
IdleTimeout int `json:"idle_timeout" yaml:"idle-timeout"`
Concurrency int `json,yaml:"concurrency"`
}
@@ -17,7 +17,7 @@ func init() {
return &Config{
Mux: MuxConfig{
Enabled: false,
Timeout: 30,
IdleTimeout: 30,
Concurrency: 8,
},
}
+3 -2
View File
@@ -2,9 +2,10 @@ package mux
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"testing"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
@@ -15,7 +16,7 @@ func TestMux(t *testing.T) {
Mux: MuxConfig{
Enabled: true,
Concurrency: 8,
Timeout: 10,
IdleTimeout: 60,
},
}
ctx := config.WithConfig(context.Background(), Name, muxCfg)
+6 -5
View File
@@ -2,6 +2,12 @@ package router
import (
"context"
"io/ioutil"
"net"
"regexp"
"strconv"
"strings"
"github.com/golang/protobuf/proto"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
@@ -9,11 +15,6 @@ import (
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/p4gefau1t/trojan-go/tunnel/freedom"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"io/ioutil"
"net"
"regexp"
"strconv"
"strings"
v2router "v2ray.com/core/app/router"
)
+2 -1
View File
@@ -1,10 +1,11 @@
package router
import (
"os"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"os"
)
type Config struct {
+3 -2
View File
@@ -2,11 +2,12 @@ package router
import (
"context"
"io"
"net"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"io"
"net"
)
type packetInfo struct {
+5 -4
View File
@@ -2,15 +2,16 @@ package router
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel"
"net"
"strconv"
"strings"
"testing"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel"
)
type MockClient struct{}
+1
View File
@@ -2,6 +2,7 @@ package router
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+1
View File
@@ -2,6 +2,7 @@ package shadowsocks
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
+2 -1
View File
@@ -1,8 +1,9 @@
package shadowsocks
import (
"github.com/p4gefau1t/trojan-go/tunnel"
"net"
"github.com/p4gefau1t/trojan-go/tunnel"
)
type Conn struct {
+2 -1
View File
@@ -2,13 +2,14 @@ package shadowsocks
import (
"context"
"net"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/redirector"
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/shadowsocks/go-shadowsocks2/core"
"net"
)
type Server struct {
+5 -4
View File
@@ -3,15 +3,16 @@ package shadowsocks
import (
"context"
"fmt"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"net"
"strconv"
"strings"
"sync"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
)
func TestShadowsocks(t *testing.T) {
+1
View File
@@ -2,6 +2,7 @@ package shadowsocks
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+1
View File
@@ -2,6 +2,7 @@ package simplesocks
import (
"context"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/common"
+1
View File
@@ -3,6 +3,7 @@ package simplesocks
import (
"context"
"fmt"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/common"
+2 -1
View File
@@ -3,9 +3,10 @@ package simplesocks
import (
"context"
"fmt"
"testing"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/test/util"
+5 -4
View File
@@ -3,16 +3,17 @@ package socks
import (
"context"
"fmt"
"net"
"sync"
"testing"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"golang.org/x/net/proxy"
"net"
"sync"
"testing"
"time"
)
func TestSocks(t *testing.T) {
+4 -3
View File
@@ -5,6 +5,10 @@ import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"io"
"io/ioutil"
"strings"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
@@ -13,9 +17,6 @@ import (
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"github.com/p4gefau1t/trojan-go/tunnel/websocket"
utls "github.com/refraction-networking/utls"
"io"
"io/ioutil"
"strings"
)
// Client is a tls client
+1
View File
@@ -2,6 +2,7 @@ package fingerprint
import (
"crypto/tls"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
. "github.com/refraction-networking/utls"
+4 -3
View File
@@ -2,13 +2,14 @@ package tls
import (
"context"
"net"
"sync"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"net"
"sync"
"testing"
)
var cert string = `
+1
View File
@@ -2,6 +2,7 @@ package tls
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+2 -1
View File
@@ -3,8 +3,9 @@
package tproxy
import (
"github.com/p4gefau1t/trojan-go/tunnel"
"net"
"github.com/p4gefau1t/trojan-go/tunnel"
)
type Conn struct {
+5 -4
View File
@@ -4,16 +4,17 @@ package tproxy
import (
"context"
"io"
"net"
"sync"
"time"
"github.com/LiamHaworth/go-tproxy"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/p4gefau1t/trojan-go/tunnel/dokodemo"
"io"
"net"
"sync"
"time"
)
const MaxPacketSize = 1024 * 8
+1
View File
@@ -4,6 +4,7 @@ package tproxy
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+5 -4
View File
@@ -2,14 +2,15 @@ package transport
import (
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"net"
"os"
"os/exec"
"strconv"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
)
// Client implements tunnel.Client
+5 -4
View File
@@ -3,15 +3,16 @@ package transport
import (
"bufio"
"context"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"net"
"net/http"
"os"
"os/exec"
"strconv"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
)
// Server is a server of transport layer
+2 -1
View File
@@ -2,11 +2,12 @@ package transport
import (
"context"
"github.com/p4gefau1t/trojan-go/config"
"net"
"sync"
"testing"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/test/util"
)
+3 -2
View File
@@ -3,12 +3,13 @@ package trojan
import (
"bytes"
"context"
"net"
"time"
"github.com/p4gefau1t/trojan-go/api"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/statistic/memory"
"github.com/p4gefau1t/trojan-go/tunnel/mux"
"net"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/log"
+2 -1
View File
@@ -3,11 +3,12 @@ package trojan
import (
"bytes"
"encoding/binary"
"github.com/p4gefau1t/trojan-go/log"
"io"
"io/ioutil"
"net"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+4 -3
View File
@@ -4,6 +4,10 @@ import (
"bytes"
"context"
"fmt"
"io"
"net"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
_ "github.com/p4gefau1t/trojan-go/log/golog"
@@ -12,9 +16,6 @@ import (
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"io"
"net"
"testing"
)
type MockUser struct {
+2 -1
View File
@@ -2,12 +2,13 @@ package websocket
import (
"context"
"strings"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/tunnel"
"golang.org/x/net/websocket"
"strings"
)
type Client struct {
+1
View File
@@ -2,6 +2,7 @@ package websocket
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
"golang.org/x/net/websocket"
)
+9 -8
View File
@@ -3,22 +3,23 @@ package websocket
import (
"bufio"
"context"
"math/rand"
"net"
"net/http"
"strings"
"time"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/log"
"github.com/p4gefau1t/trojan-go/redirector"
"github.com/p4gefau1t/trojan-go/tunnel"
"golang.org/x/net/websocket"
"math/rand"
"net"
"net/http"
"strings"
"time"
)
// Fake response writer
// Websocket ServeHTTP method uses Hijack method to get the ReadWriter
type fakeHttpResponseWriter struct {
type fakeHTTPResponseWriter struct {
http.Hijacker
http.ResponseWriter
@@ -26,7 +27,7 @@ type fakeHttpResponseWriter struct {
Conn net.Conn
}
func (w *fakeHttpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
func (w *fakeHTTPResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return w.Conn, w.ReadWriter, nil
}
@@ -111,7 +112,7 @@ func (s *Server) AcceptConn(tunnel.Tunnel) (tunnel.Conn, error) {
},
}
respWriter := &fakeHttpResponseWriter{
respWriter := &fakeHTTPResponseWriter{
Conn: conn,
ReadWriter: rw,
}
+1
View File
@@ -2,6 +2,7 @@ package websocket
import (
"context"
"github.com/p4gefau1t/trojan-go/tunnel"
)
+3 -2
View File
@@ -2,13 +2,14 @@ package websocket
import (
"context"
"sync"
"testing"
"github.com/p4gefau1t/trojan-go/common"
"github.com/p4gefau1t/trojan-go/config"
"github.com/p4gefau1t/trojan-go/test/util"
"github.com/p4gefau1t/trojan-go/tunnel"
"github.com/p4gefau1t/trojan-go/tunnel/transport"
"sync"
"testing"
)
func TestWebsocket(t *testing.T) {
+2 -1
View File
@@ -3,9 +3,10 @@ package version
import (
"flag"
"fmt"
"runtime"
"github.com/p4gefau1t/trojan-go/constant"
"github.com/p4gefau1t/trojan-go/option"
"runtime"
"github.com/p4gefau1t/trojan-go/common"
)