xream / http-meta

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTP META

社群

👏🏻 欢迎加入社群进行交流讨论

👥 群组 折腾啥(群组)

📢 频道 折腾啥(频道)

Usage

⚠️ If a proxy is already running on the device running http-meta, you may need to exclude the http-meta process.

The Easy Way(for example, on an Android device)

Create a folder /data/http-meta

Download http-meta.bundle.js, rename it to http-meta.bundle.jsand move it to the /data/http-meta folder.

Create a folder /data/http-meta/meta

Download Meta, rename it to http-meta and move it to the /data/http-meta/meta folder.

Download tpl.yaml, rename it to tpl.yaml and move it to the /data/http-meta/meta folder.

META_FOLDER can be the absolute path of the meta folder if neccessary.

META_TEMP_FOLDER can be the absolute path of the temp folder if neccessary. Defaults to the default directory for temporary files of the operating system. This path may have to be provided in the Android environment.

META_TEMP_FOLDER=/data/http-meta META_FOLDER=/data/http-meta/meta HOST=127.0.0.1 PORT=9876 node http-meta.bundle.js

The Hard Way

cd /data

git clone https://github.com/xream/http-meta.git http-meta

cd /data/http-meta

Download Meta, rename it to http-meta and move it to the /data/http-meta/meta folder.

cd /data/http-meta

pnpm i

META_FOLDER can be the absolute path of the meta folder if neccessary.

META_TEMP_FOLDER can be the absolute path of the temp folder if neccessary. Defaults to the default directory for temporary files of the operating system. This path may have to be provided in the Android environment.

META_TEMP_FOLDER=/data/http-meta META_FOLDER=/data/http-meta/meta HOST=127.0.0.1 PORT=9876 pnpm start

Authorization

Set the AUTHORIZATION environment variable to enable authorization.

Add the Authorization header to the request.

Test

curl '127.0.0.1:9876/test'

Response

{
    "pid": 35955,
    "log":"INFO Mixed(http+socks)[listener-proxy-0] proxy listening at: [::]:65535",
    "config": "bind-address: 0.0.0.0\nallow-lan: true"
}

Start (always start a new one)

curl '127.0.0.1:9876/start' \
--header 'Content-Type: application/json' \
--data '{
    "timeout": 1800000, // process will be killed after 30 minutes(default)
    "proxies": [
        {
            "name": "1",
            "server": "1.2.3.4",
            "port": 80,
            "type": "vmess",
            ...
        }
    ]
}'

Response

{
    "ports": [
        65534,
        65533
    ],
    "pid": 61289
}

Retart(stop all and start a new one)

curl '127.0.0.1:9876/start' \
--header 'Content-Type: application/json' \
--data '{
    "timeout": 1800000, // process will be killed after 30 minutes(default)
    "proxies": [
        {
            "name": "1",
            "server": "1.2.3.4",
            "port": 80,
            "type": "vmess",
            ...
        },
          {
            "name": "2",
            "server": "1.2.3.4",
            "port": 80,
            "type": "vmess",
            ...
        }
    ]
}'

Response

{
    "ports": [
        65534,
        65533
    ],
    "pid": 61289
}

Stop

Stop All

curl --request POST '127.0.0.1:9876/stop'

Stop by PID

curl '127.0.0.1:9876/stop' \
--header 'Content-Type: application/json' \
--data '{
    "pid": [
        1,
        2
    ]
}'

Response

{
    "pid": null
}

Get Stats

curl '127.0.0.1:9876/stats' \
--header 'Content-Type: application/json'

Response

{
    "35955": {
        "pid": 35955,
        "mem": "2MB",
        "cpu": "0%"
    }
}

Get Stats by PID

curl '127.0.0.1:9876/stats' \
--header 'Content-Type: application/json' \
--data '{"pid": [35955]}'

Response

{
    "35955": {
        "pid": 35955,
        "ports": [
            65534,
            65533
        ],
        "mem": "2MB",
        "cpu": "0%"
    }
}

UDP Test(NTP via Proxy)

port: proxy port

ntp: ntp server(default: time.apple.com)

timeout: timeout(default: 3000ms)

curl '127.0.0.1:9876/udp' \
--header 'Content-Type: application/json' \
--data '{
    "port": 35955,
    "ntp": "time.apple.com",
    "timeout": 2000
}'

Response

{
    "data": "ok"
}

About

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%