forked from Ehco1996/ehco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor transpoter over interface
- Loading branch information
Showing
24 changed files
with
707 additions
and
735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,15 @@ | ||
{ | ||
"configs": [ | ||
"relay_configs": [ | ||
{ | ||
"listen": "0.0.0.0:1234", | ||
"listen": "127.0.0.1:1234", | ||
"listen_type": "raw", | ||
"remote": "0.0.0.0:5201", | ||
"transport_type": "raw" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:1235", | ||
"listen_type": "raw", | ||
"remote": "ws://0.0.0.0:2000", | ||
"transport_type": "ws" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:1236", | ||
"listen_type": "raw", | ||
"remote": "wss://0.0.0.0:2001", | ||
"transport_type": "wss" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:1237", | ||
"listen_type": "raw", | ||
"remote": "wss://0.0.0.0:2002", | ||
"transport_type": "mwss" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:1238", | ||
"listen_type": "raw", | ||
"remote": "", | ||
"udp_remote": "0.0.0.0:5201", | ||
"transport_type": "mwss", | ||
"lb_remotes": [ | ||
"wss://0.0.0.0:2002", | ||
"wss://0.0.0.0:2003" | ||
"transport_type": "raw", | ||
"tcp_remotes": [ | ||
"0.0.0.0:5201" | ||
], | ||
"udp_remotes": [ | ||
"0.0.0.0:5201" | ||
] | ||
}, | ||
{ | ||
"listen": "0.0.0.0:2000", | ||
"listen_type": "ws", | ||
"remote": "0.0.0.0:5201", | ||
"transport_type": "raw" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:2001", | ||
"listen_type": "wss", | ||
"remote": "0.0.0.0:5201", | ||
"transport_type": "raw" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:2002", | ||
"listen_type": "mwss", | ||
"remote": "0.0.0.0:5201", | ||
"transport_type": "raw" | ||
}, | ||
{ | ||
"listen": "0.0.0.0:2003", | ||
"listen_type": "mwss", | ||
"remote": "0.0.0.0:5201", | ||
"transport_type": "raw" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package constant | ||
|
||
import "time" | ||
|
||
const ( | ||
MaxMWSSStreamCnt = 10 | ||
DialTimeOut = 3 * time.Second | ||
MaxConKeepAlive = 10 * time.Minute | ||
|
||
Listen_RAW = "raw" | ||
Listen_WS = "ws" | ||
Listen_WSS = "wss" | ||
Listen_MWSS = "mwss" | ||
|
||
Transport_RAW = "raw" | ||
Transport_WS = "ws" | ||
Transport_WSS = "wss" | ||
Transport_MWSS = "mwss" | ||
|
||
BUFFER_SIZE = 4 * 1024 // 4kb | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package logger | ||
|
||
import ( | ||
"os" | ||
|
||
"go.uber.org/zap" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
var Logger *zap.SugaredLogger | ||
|
||
func init() { | ||
writers := []zapcore.WriteSyncer{zapcore.AddSync(os.Stdout)} | ||
encoder := zapcore.EncoderConfig{ | ||
CallerKey: "file", | ||
MessageKey: "msg", | ||
StacktraceKey: "stacktrace", | ||
LineEnding: zapcore.DefaultLineEnding, | ||
EncodeDuration: zapcore.SecondsDurationEncoder, | ||
EncodeCaller: zapcore.FullCallerEncoder, | ||
} | ||
core := zapcore.NewCore( | ||
zapcore.NewConsoleEncoder(encoder), | ||
zapcore.NewMultiWriteSyncer(writers...), | ||
zapcore.InfoLevel, | ||
) | ||
Logger = zap.New(core).Sugar() | ||
} |
Oops, something went wrong.