You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Pipelines.cs 979 B

1234567891011121314151617181920212223242526272829
  1. using Shadowsocks.Protocol;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Net;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Shadowsocks.CLI.Client
  9. {
  10. public class Pipelines
  11. {
  12. private TcpPipeListener? _tcpPipeListener;
  13. public Task Start(string listenSocks, string serverAddress, int serverPort, string method, string? password, string? key, string? plugin, string? pluginOpts, string? pluginArgs)
  14. {
  15. // TODO
  16. var localEP = IPEndPoint.Parse(listenSocks);
  17. var remoteEp = new DnsEndPoint(serverAddress, serverPort);
  18. byte[]? mainKey = null;
  19. if (!string.IsNullOrEmpty(key))
  20. mainKey = Encoding.UTF8.GetBytes(key);
  21. _tcpPipeListener = new(localEP);
  22. return _tcpPipeListener.Start(localEP, remoteEp, method, password, mainKey);
  23. }
  24. public void Stop() => _tcpPipeListener?.Stop();
  25. }
  26. }