Esempio n. 1
0
 public Socks5Worker(Socks5Server server, TcpClient client)
 {
     this.server = server;
     srcMask     = server.inMask;
     tarMask     = server.outMask;
     srcTCP      = client;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Util.DebugUtil.ClearLogFile();
            //Util.DebugUtil.outtype = Util.DebugUtil.INFO | Util.DebugUtil.ERROR | Util.DebugUtil.FILE;
            //Util.DebugUtil.outtype = Util.DebugUtil.INFO | Util.DebugUtil.FILE;
            Util.DebugUtil.outtype = Util.DebugUtil.INFO;
            server = new Socks5.Socks5Server();
            Dictionary <string, object> json = null;

            if (args.Length > 0 && File.Exists(args[0]))
            {
                json = ReadConfig(args[0]);
            }
            if (File.Exists(CONFIG_FILE))
            {
                json = ReadConfig(CONFIG_FILE);
            }
            else
            {
                MakeDefaultConfig();
            }
            if (json != null && json.Count > 0)
            {
                server.host = (string)json["host"];
                server.port = (int)json["port"];
                if (json.ContainsKey("parent_host"))
                {
                    server.parentHost = (string)json["parent_host"];
                }
                if (json.ContainsKey("parent_port"))
                {
                    server.parentPort = (int)json["parent_port"];
                }
                if (json.ContainsKey("mask_number"))
                {
                    server.enMaskNum = (int)json["mask_number"];
                }
                if (json.ContainsKey("in_mask"))
                {
                    server.inMask = (bool)json["in_mask"];
                }
                if (json.ContainsKey("out_mask"))
                {
                    server.outMask = (bool)json["out_mask"];
                }
            }
            server.Start();
            while (true)
            {
                Console.ReadLine();
            }
        }