GFW-knocker / gfw_resist_tls_proxy

knock up GFW sni detection in tls client hello
GNU General Public License v3.0
1.68k stars 230 forks source link

some suggestions from chatgpt #49

Open developer861 opened 1 year ago

developer861 commented 1 year ago

Some possible suggestions to make this project better are:

1.Use a context manager or a try-finally block to ensure that the sockets are closed properly, even if an exception occurs. This will prevent resource leaks and errors. For example: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:

do something with s

2.Use logging instead of print statements to record the events and errors in the socket communication. This will make it easier to debug and monitor the program. For example: import logging logging.basicConfig(level=logging.INFO) logging.info('os is linux')

3.Use argparse or a configuration file to store and parse the constants, such as listen_PORT, Cloudflare_IP, num_fragment, etc. This will make it easier to change and customize the parameters without modifying the code. For example: import argparse parser = argparse.ArgumentParser() parser.add_argument('--port', type=int, default=2500, help='listening port') args = parser.parse_args() listen_PORT = args.port

4.Use comments and docstrings to document the purpose and functionality of the code. This will make it easier to understand and maintain the code. For example: def listen(self): """Listen for incoming connections and spawn a thread for each one.""" self.sock.listen(128) # up to 128 concurrent unaccepted socket queued , the more is refused untill accepting those. while True: client_sock , client_addr = self.sock.accept()
client_sock.settimeout(my_socket_timeout)

create a new thread to handle the client connection

    threading.Thread(target=self.handle_client, args=(client_sock, client_addr)).start()
developer861 commented 1 year ago

Some possible suggestions to make this project better and bypass GFW better are:

1.Use encryption and obfuscation techniques to disguise the proxy traffic as normal web traffic. This will make it harder for the GFW to detect and block the proxy. For example, you can use tools like trojan, v2ray, or shadowsocks with plugins that support encryption and obfuscation.

2.Use domain fronting to hide the proxy server behind a legitimate domain name that is not blocked by the GFW. This will make it difficult for the GFW to filter the traffic based on the SNI field. For example, you can use tools like meek or snowflake that use domain fronting.

3.Use IPv6 instead of IPv4 to access the proxy server, as the GFW has less control over IPv6 traffic. This will make it easier to bypass the GFW and access blocked websites. For example, you can use tools like miredo or teredo that enable IPv6 connectivity over IPv4 networks.

developer861 commented 1 year ago

1.Use pluggable transports to transform the proxy traffic into different forms that are hard to detect and block by the GFW. For example, you can use tools like snowflake, obfs4, or scramblesuit that use various techniques to obfuscate the traffic.

2.Use bridges to connect to the proxy server through an intermediate server that is not blocked by the GFW. This will make it harder for the GFW to identify and block the proxy server. For example, you can use tools like tor bridges, psiphon, or outline that provide bridge servers.

3.Use circumvention systems that leverage existing platforms or protocols that are not blocked by the GFW. This will make it difficult for the GFW to distinguish the proxy traffic from the normal traffic. For example, you can use tools like telex, tapdance, or refraction networking that use covert channels to bypass censorship.

developer861 commented 1 year ago

https://github.com/ValdikSS/GoodbyeDPI به اینم یه نگاهی بندازید

developer861 commented 1 year ago

1.You could add some error handling and logging mechanisms to your script, so that you can debug and monitor the performance of your proxy server more easily.

2.You could implement some encryption or obfuscation techniques to your proxy server, so that the GFW cannot detect or block your traffic easily.

3.You could add some features to your proxy server, such as caching, compression, or load balancing, to improve the speed and efficiency of your proxy server.

developer861 commented 1 year ago

https://github.com/GaukasWang/GFW-2021Summer-TLS-RST-Incident