mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-09-11 02:34:32 +00:00
Obfuscator interface in core & relay/proxy CLI support
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/lucas-clemente/quic-go/congestion"
|
||||
hyCongestion "github.com/tobyxdd/hysteria/pkg/congestion"
|
||||
"github.com/tobyxdd/hysteria/pkg/core"
|
||||
"github.com/tobyxdd/hysteria/pkg/obfs"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
@@ -55,11 +56,17 @@ func proxyServer(args []string) {
|
||||
log.Println("WARNING: No authentication configured. This server can be used by anyone!")
|
||||
}
|
||||
|
||||
var obfuscator core.Obfuscator
|
||||
if len(config.Obfs) > 0 {
|
||||
obfuscator = obfs.XORObfuscator(config.Obfs)
|
||||
}
|
||||
|
||||
server, err := core.NewServer(config.ListenAddr, tlsConfig, quicConfig,
|
||||
uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps,
|
||||
func(refBPS uint64) congestion.SendAlgorithmWithDebugInfos {
|
||||
return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS))
|
||||
},
|
||||
obfuscator,
|
||||
func(addr net.Addr, username string, password string, sSend uint64, sRecv uint64) (core.AuthResult, string) {
|
||||
if len(config.AuthFile) == 0 {
|
||||
log.Printf("%s (%s) connected, negotiated speed (Mbps): Up %d / Down %d\n",
|
||||
|
Reference in New Issue
Block a user