Jump to content

gamingmagic

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by gamingmagic

  1. On 8/22/2023 at 12:47 AM, Rynbef said:

    I would prefer ufw for it. But it's only my personal opinion.

     

    Rynbef~

    Yeah even python is possible. If you say something, you better share the code.

     

    import socket
    import threading

    # Configuration for login-server
    LOGIN_SERVER_PROXY_HOST = '45.118.132.189'
    LOGIN_SERVER_PROXY_PORT = 6050
    LOGIN_SERVER_TARGET_HOST = 'xx.xx.xx.xx'
    LOGIN_SERVER_TARGET_PORT = 6050

    # Configuration for char-server
    CHAR_SERVER_PROXY_HOST = '45.118.132.189'
    CHAR_SERVER_PROXY_PORT = 6051
    CHAR_SERVER_TARGET_HOST = 'xx.xx.xx.xx'
    CHAR_SERVER_TARGET_PORT = 6051

    # Configuration for map-server
    MAP_SERVER_PROXY_HOST = '45.118.132.189'
    MAP_SERVER_PROXY_PORT = 6052
    MAP_SERVER_TARGET_HOST = 'xx.xx.xx.xx'
    MAP_SERVER_TARGET_PORT = 6052

    # Forward traffic between source and destination sockets
    def forward_traffic(source_socket, destination_socket):
        while True:
            data = source_socket.recv(4096)
            if len(data) == 0:
                break
            destination_socket.sendall(data)

    # Main proxy server loop
    def proxy_server(proxy_host, proxy_port, target_host, target_port):
        proxy_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        proxy_socket.bind((proxy_host, proxy_port))
        proxy_socket.listen(5)

        print(f"Proxy server is listening on {proxy_host}:{proxy_port}")

        while True:
            client_socket, addr = proxy_socket.accept()
            client_ip = addr[0]
            print(f"Accepted connection from {client_ip}:{addr[1]}")

            # Start a new thread to handle the client
            client_thread = threading.Thread(target=handle_client, args=(client_socket, client_ip, target_host, target_port))
            client_thread.start()

    # Handle client requests
    def handle_client(client_socket, client_ip, target_host, target_port):
        # Connect to the target server
        target_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        target_socket.connect((target_host, target_port))

        # Forward client IP to the target server
        target_socket.sendall(client_ip.encode())

        # Forward traffic between client and target server
        client_to_target_thread = threading.Thread(target=forward_traffic, args=(client_socket, target_socket))
        target_to_client_thread = threading.Thread(target=forward_traffic, args=(target_socket, client_socket))

        client_to_target_thread.start()
        target_to_client_thread.start()

        # Wait for the threads to complete
        client_to_target_thread.join()
        target_to_client_thread.join()

        # Close the sockets
        client_socket.close()
        target_socket.close()

    # Start the proxy servers
    def start_proxy_servers():
        # Start login-server proxy
        login_server_thread = threading.Thread(target=proxy_server, args=(LOGIN_SERVER_PROXY_HOST, LOGIN_SERVER_PROXY_PORT, LOGIN_SERVER_TARGET_HOST, LOGIN_SERVER_TARGET_PORT))
        login_server_thread.start()

        # Start char-server proxy
        char_server_thread = threading.Thread(target=proxy_server, args=(CHAR_SERVER_PROXY_HOST, CHAR_SERVER_PROXY_PORT, CHAR_SERVER_TARGET_HOST, CHAR_SERVER_TARGET_PORT))
        char_server_thread.start()

        # Start map-server proxy
        map_server_thread = threading.Thread(target=proxy_server, args=(MAP_SERVER_PROXY_HOST, MAP_SERVER_PROXY_PORT, MAP_SERVER_TARGET_HOST, MAP_SERVER_TARGET_PORT
     

  2. HI I ALWAYS FORGOT THE CONFIGURATION AND ALWAYS NEED TO CONVERT WITH IPTABLES THE GUIDE IN RATHENA.

     

    IN THIS REGARDS I JUST WANNA SHARE SO WHEN I GOOGLE IT I WILL NOT FORGET ABOUT IT.

     

    sysctl net.ipv4.ip_forward=1
    iptables -t nat -A POSTROUTING -j MASQUERADE
    iptables -t nat -A PREROUTING -p tcp --dport 6121 -j DNAT --to-destination XXX.XXX.XXX.XXX:6121
    iptables -t nat -A PREROUTING -p tcp --dport 5121 -j DNAT --to-destination XXX.XXX.XXX.XXX:5121
    iptables -t nat -A PREROUTING -p tcp --dport 6900 -j DNAT --to-destination XXX.XXX.XXX.XXX:6900


    iptables-save > /etc/iptables_rules

    iptables-save > /etc/iptables_rules   
    iptables -A INPUT -p tcp --dport 6900 -m state --state NEW -j ACCEPT
    iptables -A INPUT -p tcp --dport 6121 -m state --state NEW -j ACCEPT
    iptables -A INPUT -p tcp --dport 5121 -m state --state NEW -j ACCEPT

    iptables -A INPUT -p udp --dport 6900 -m state --state NEW -j ACCEPT
    iptables -A INPUT -p udp --dport 6121 -m state --state NEW -j ACCEPT
    iptables -A INPUT -p udp --dport 5121 -m state --state NEW -j ACCEPT

    • Love 1
  3. On 12/18/2020 at 11:17 AM, kalabasa said:
    
    
    Error	C2039	'jname': is not a member of 'item_data'	map-server	c:\users\user\documents\ra\rathena\src\map\clif.cpp	13779	
    Error	C2660	'strcat': function does not take 1 arguments	map-server	c:\users\user\documents\ra\rathena\src\map\clif.cpp	13779	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\skill.cpp	8110	
    Error	C2039	'jname': is not a member of 'item_data'	map-server	c:\users\user\documents\ra\rathena\src\map\skill.cpp	17757	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\vending.cpp	101	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\vending.cpp	335	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\vending.cpp	366	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\vending.cpp	374	
    Error	C3861	'itemdb_jname': identifier not found	map-server	c:\users\user\documents\ra\rathena\src\map\vending.cpp	400	

    latest pull

    #define itemdb_ename(n) itemdb_search(n)->ename.c_str()

    check that line revise it.

    dont use jname

  4. On 2/27/2021 at 4:56 PM, ProjectFaust said:

    Hi i'm facing the same problem even thou my item already YAML

    any suggestion?

    its not yml sucks. they change jname to ename

    #define itemdb_ename(n) itemdb_search(n)->ename.c_str()

     

    • Upvote 1
  5. drop down arrow not working. rofl

    <a href="#" class="nav-link dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo htmlspecialchars(Flux::message($menuCategory)) ?></a>
                                <div class="dropdown-menu">
                                <?php foreach ($menus as $menuItem):  ?>
                                    <a class="dropdown-item" href="<?php echo $menuItem['url'] ?>"><?php echo htmlspecialchars(Flux::message($menuItem['name'])) ?></a>

    what should i input ROFL

    dont use this theme. no support. just taking your money.

×
×
  • Create New...