]> code.delx.au - proxy/blobdiff - socks5server.c
Style changes
[proxy] / socks5server.c
index 972687d5d3a7dc77b18c02d99df6f9ae0a7300bd..4e1f6fdcdc140832f503656b62b695e259c884b0 100644 (file)
@@ -16,6 +16,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#ifndef VERSION
+#define VERSION "dev"
+#endif
 
 
 /***********
@@ -254,10 +257,7 @@ void* proxy_copy_from_dest(void* _data) {
     return NULL;
 }
 
-bool proxy_create_copy_from_dest_thread(
-    int dst_fd,
-    int src_fd
-) {
+bool proxy_create_copy_from_dest_thread(int dst_fd, int src_fd) {
     struct proxy_copy_from_dest_data* data = smalloc(sizeof(struct proxy_copy_from_dest_data));
     data->dst_fd = dst_fd;
     data->src_fd = src_fd;
@@ -461,12 +461,12 @@ bool proxy_handle_request(int* dst_fd, int fd) {
         return false;
     }
     switch (addr_type) {
-        case 1:
-            return proxy_ipv4_handle_request(dst_fd, fd);
-        case 3:
-            return proxy_dns_handle_request(dst_fd, fd);
-        case 4:
-            return proxy_ipv6_handle_request(dst_fd, fd);
+    case 1:
+        return proxy_ipv4_handle_request(dst_fd, fd);
+    case 3:
+        return proxy_dns_handle_request(dst_fd, fd);
+    case 4:
+        return proxy_ipv6_handle_request(dst_fd, fd);
     }
 
     proxy_write_error_response(fd, 8);
@@ -591,11 +591,10 @@ void rewrite_ipv4_mapped_address(struct sockaddr_storage* addr) {
     }
 
     struct in6_addr* addr_data = &((struct sockaddr_in6*)addr)->sin6_addr;
-    if (!(
-        ((uint32_t*)(addr_data))[0] == 0 &&
-        ((uint32_t*)(addr_data))[1] == 0 &&
-        ((uint32_t*)(addr_data))[2] == htonl(0xffff)
-    )) {
+    if (!(((uint32_t*)(addr_data))[0] == 0 &&
+          ((uint32_t*)(addr_data))[1] == 0 &&
+          ((uint32_t*)(addr_data))[2] == htonl(0xffff)))
+    {
         return;
     }