mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-03 20:47:38 +03:00
feat: client handshake info
This commit is contained in:
parent
cccb9558c0
commit
0a77ce4d64
8 changed files with 148 additions and 34 deletions
|
@ -402,8 +402,8 @@ func runClient(cmd *cobra.Command, args []string) {
|
|||
logger.Fatal("failed to load client config", zap.Error(err))
|
||||
}
|
||||
|
||||
c, err := client.NewReconnectableClient(hyConfig, func(c client.Client, count int) {
|
||||
connectLog(count)
|
||||
c, err := client.NewReconnectableClient(hyConfig, func(c client.Client, info *client.HandshakeInfo, count int) {
|
||||
connectLog(info, count)
|
||||
// On the client side, we start checking for updates after we successfully connect
|
||||
// to the server, which, depending on whether lazy mode is enabled, may or may not
|
||||
// be immediately after the client starts. We don't want the update check request
|
||||
|
@ -699,8 +699,11 @@ func (f *adaptiveConnFactory) New(addr net.Addr) (net.PacketConn, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func connectLog(count int) {
|
||||
logger.Info("connected to server", zap.Int("count", count))
|
||||
func connectLog(info *client.HandshakeInfo, count int) {
|
||||
logger.Info("connected to server",
|
||||
zap.Bool("udpEnabled", info.UDPEnabled),
|
||||
zap.Uint64("tx", info.Tx),
|
||||
zap.Int("count", count))
|
||||
}
|
||||
|
||||
type socks5Logger struct{}
|
||||
|
|
|
@ -42,13 +42,16 @@ func runPing(cmd *cobra.Command, args []string) {
|
|||
logger.Fatal("failed to load client config", zap.Error(err))
|
||||
}
|
||||
|
||||
c, err := client.NewClient(hyConfig)
|
||||
c, info, err := client.NewClient(hyConfig)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to initialize client", zap.Error(err))
|
||||
}
|
||||
defer c.Close()
|
||||
logger.Info("connected to server",
|
||||
zap.Bool("udpEnabled", info.UDPEnabled),
|
||||
zap.Uint64("tx", info.Tx))
|
||||
|
||||
logger.Info("connecting", zap.String("address", addr))
|
||||
logger.Info("connecting", zap.String("addr", addr))
|
||||
start := time.Now()
|
||||
conn, err := c.TCP(addr)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue