Skip to content

This is an implementation of the SOCKS v5 server in the OpenResty

License

Notifications You must be signed in to change notification settings

ustclug/lua-resty-socks5-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name

lua-resty-socks5-server

This is an implementation of the SOCKS v5 RFC1928 server in the OpenResty and It's based on the stream-lua-ningx-module under the hood.

Table of Contents

Status

Experimental (works well on personal server)

Usage

Make sure your stream_lua_nginx's cosocket support the API tcpsock:receive('*b'), we are rely on it to implementation full duplex between upstream and downstream.

    server {
        listen 1234;

        set $upstream "";
        proxy_pass $upstream;

        preread_by_lua_block {
                local socks5_server = require "lib.resty.socks5.server"

                socks5_server.run(3000)
                -- or if you want to enable authentication
                -- socks5_server.run(3000, "username", "password")
        }
    }

API

run

syntax: module.run(timeout[,username, password])

run a socks5 server.

  • timeout The socket timeout (default 1000 ms) include connect、read、write between upstream and downstream.

  • username The socks5 authentication username.

  • password The socks5 authentication username.

Contributing

To contribute to lua-resty-socks5-server, clone this repo locally and commit your code on a separate branch.

PS: PR Welcome 🚀 🚀 🚀 🚀

Author

GitHub @detailyang

License

lua-resty-socks5-server is licensed under the MIT license.

About

This is an implementation of the SOCKS v5 server in the OpenResty

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 99.3%
  • Makefile 0.7%