ServerAddr 支持通过域名

This commit is contained in:
SpringHgui 2020-08-02 15:47:15 +08:00
parent f7f20cc206
commit 7d06a3d709
3 changed files with 6 additions and 8 deletions

View File

@ -8,7 +8,7 @@
},
"ClientSettings": {
"Common": {
// ip, BindAddr
// ip, BindAddr,
"ServerAddr": "127.0.0.1",
// BindPort

View File

@ -10,14 +10,14 @@ namespace FastTunnel.Core
{
public class Connecter
{
private string _ip;
private string _host;
private int _port;
public Socket Socket { get; set; }
public Connecter(string v1, int v2, int? sendTimeout = null)
{
this._ip = v1;
this._host = v1;
this._port = v2;
Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@ -34,10 +34,8 @@ namespace FastTunnel.Core
public void Connect()
{
IPAddress ip = IPAddress.Parse(_ip);
IPEndPoint point = new IPEndPoint(ip, _port);
Socket.Connect(point);
DnsEndPoint dnsEndPoint = new DnsEndPoint(_host, _port);
Socket.Connect(dnsEndPoint);
}
public void Send(byte[] data)

View File

@ -142,7 +142,7 @@ namespace FastTunnel.Core.Core
return;
}
//LogSuccess(_client.Socket);
LogSuccess(_client.Socket);
}
void Close()