mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
Add trace log for connecting, bump version to v1.8.4
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "shadowsocks-rust"
|
||||
version = "1.8.3"
|
||||
version = "1.8.4"
|
||||
authors = ["Y. T. CHUNG <zonyitoo@gmail.com>"]
|
||||
description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls."
|
||||
repository = "https://github.com/zonyitoo/shadowsocks-rust"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use std::{io, net::SocketAddr};
|
||||
|
||||
use log::trace;
|
||||
use socket2::{Domain, SockAddr, Socket, Type};
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
@@ -11,6 +12,8 @@ use tokio::net::TcpStream;
|
||||
pub async fn connect_tcp_stream(addr: &SocketAddr, outbound_addr: &Option<SocketAddr>) -> io::Result<TcpStream> {
|
||||
match *outbound_addr {
|
||||
None => {
|
||||
trace!("Connecting {}", addr);
|
||||
|
||||
// Connect with tokio's default API directly
|
||||
TcpStream::connect(addr).await
|
||||
}
|
||||
@@ -18,6 +21,8 @@ pub async fn connect_tcp_stream(addr: &SocketAddr, outbound_addr: &Option<Socket
|
||||
// Create TcpStream manually from socket
|
||||
// These functions may not behave exactly the same as tokio's TcpStream::connect
|
||||
|
||||
trace!("Connecting {} from {}", addr, bind_addr);
|
||||
|
||||
let socket = match *addr {
|
||||
SocketAddr::V4(..) => Socket::new(Domain::ipv4(), Type::stream(), None)?,
|
||||
SocketAddr::V6(..) => Socket::new(Domain::ipv6(), Type::stream(), None)?,
|
||||
|
||||
Reference in New Issue
Block a user