Skip to content

radioactiveAHM/ray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

123 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray

Ray is an asynchronous VLESS server protocol implemented in Rust.
Note: This project is intended as a personal portfolio piece and is not actively maintained. Pull requests will not be accepted.

Transports

  • HTTP
  • HTTP Upgrade
  • WS (WebSocket)
  • XHTTP H2 stream-one, stream-up, packet-up

Vless Request Commands

  • TCP
  • UDP
  • XUDP

Configuration File config.json

{
    "runtime": {
        "runtime_mode": "Multi", // Multi, Single.
        "worker_threads": null, // null for default. only for Multi mode.
        "thread_stack_size": null, // null for default.
        "event_interval": null, // null for default.
        "global_queue_interval": null, // null for default.
        "max_io_events_per_tick": null, // null for default. only for Single mode.
        "thread_keep_alive": null // null for default. In seconds.
    },
    "log": {
        "level": "warn", // error, warn, info, debug, trace. set null to disable
        "file": "l.log" // set null to log to Stdout
    },
    "tls_buffer_limit": 64,
    "tcp_proxy_buffer_size": [128, 128], // The internal buffer size (read, write) for the TCP proxy. Unit is Kb.
    "udp_proxy_buffer_size": [8, 128], // The internal buffer size (read, write) for the UDP proxy. Unit is Kb.
    "tcp_idle_timeout": 150, // TCP idle timeout in seconds.
    "udp_idle_timeout": 90, // UDP idle timeout in seconds.
    "users": [ // User list
        {
            "name": "admin",
            "uuid": "a18b0775-2669-5cfc-b5e8-99bd5fd70884"
        }
    ],
    "inbounds":[
        // inbound objects
        {
            "listen": "0.0.0.0:80", // Server listening address and port. [::] works for both ipv4 and ipv6 in linux (dual stack).
            "transporter": "TCP", // Transport protocol
            "outbound": "direct", // default outbound tag
            "tls": { // TLS Configuration
                "enable": false, // Enable tls
                "tls13_tickets": 6,
                "max_fragment_size": null, // The maximum size of plaintext input to be emitted in a single TLS record. A value of null is equivalent to the TLS maximum of 16 kB. Unit is bytes.
                "alpn": ["h2", "http/1.1"],
                "certificate": "cert.pem", // Certificate Path
                "key": "key.pem" // Key Path
            }
        }
    ],
    "outbounds": { // Map object of outbounds
        "direct": {
            "opt": {
                "tcp_read_buffered": false,
                "interface": null,
                "bind_to_device": false,
                "mss": null,
                "congestion": null,
                "send_buffer_size": null,
                "recv_buffer_size": null,
                "nodelay": null,
                "keepalive": null
            }
        }
    },
    "resolver": { // Built-in domain resolver supporting multiple protocols: udp, https, h3, tls, and quic
        "resolver": null, // 'null' or "udp://example" defaults to UDP; for other protocols, use: "https://dns.google", "h3://dns.google", "tls://dns.google", "quic://dns.google"
        "ips": ["1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001"],
        "port": 53,
        "trust_negative_responses": true,
        "ip_strategy": "Ipv4thenIpv6", // Options: Ipv4Only, Ipv6Only, Ipv4AndIpv6, Ipv6thenIpv4, Ipv4thenIpv6,
        "cache_size": 64, // Cache size is in number of records
        "timeout": 2, // Specify the timeout for a request.
        "num_concurrent_reqs": 8 // Number of concurrent requests per query. Where more than one nameserver is configured, this configures the resolver to send queries to a number of servers in parallel. Defaults to 2; 0 or 1 will execute requests serially.
    },
    "rules": null
}

Transports Configuration

TCP

    "transporter": "TCP"

HTTP

    "transporter": {
        "HTTP": {
            "path": "/",
            "host": "example.com", // If set null any host will be accepted
            "method": "GET"
        }
    }

HttpUpgrade

    "transporter": {
        "HttpUpgrade": {
            "path": "/",
            "host": "example.com", // If set null any host will be accepted
            "method": "GET"
        }
    }

WS

    "transporter": {
        "WS": {
            "path": "/",
            "host": "example.com", // If set null any host will be accepted.
            "frame_size": null // Max Outgoing frame size. The default is 1MB. Unit is Kb.
        }
    }

XHTTP

    "transporter": {
        "XHTTP" : {
            "path": "/",
            "host": "example.com", // If set null any host will be accepted.
            "max_frame_size": 16, // Must be less or equal to tcp_proxy_buffer_size and at least 16kb. Unit is Kb.
            "max_send_buffer_size": 1024, // Sets the maximum send buffer size per stream. Unit is Kb.
            "initial_connection_window_size": 16384, // Indicates the initial window size (in octets) for connection-level flow control for received data. Unit is Kb.
            "initial_window_size": 1024, // Indicates the initial window size (in octets) for stream-level flow control for received data. Unit is Kb.
            // stream-up/stream-one/packet-up
            "stream_window_size_cap": 512, // suggested (initial_window_size/2)
            // stream-up
            "stream_up_keepalive": [[60, 90], [10, 128]], //up-stream data link keep-alive. [duration(sec)[min-max], bytes[min, max]]. set null to disable.
            // packet-up
            "initial_channel_size": 8, // Defines the initial channel size used for POST data and the buffer capacity for POST request data frames.
            "recv_timeout": 12 // Defines the timeout (in seconds) applied to each POST request when awaiting a data frame.
        }
    }

Rules Configuration

    "rules": [
        {
            "domains": [
                "google.com", // This will block any domain containing google.com for example mail.google.com.
                "googleadservices.com"
            ],
            "ips": [
                "192.168.0.1",
                "[2606:4700:4700::1111]"
            ],
            "operation": "Reject"
        },
        {
            "domains": null,
            "ips": [
                "8.8.8.8"
            ],
            "operation": {
                "Outbound": "outbound-tag"
            }
        },
    ]

About

Vless protocol written in rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages