修改天翼云盘lua
该修改哪里?微信可以发消息,其他的没网
-- file: lua/backend-baidu.lua
local http = require 'http'local backend = require 'backend'
local char = string.charlocal byte = string.bytelocal find = string.findlocal sub = string.sub
local ADDRESS = backend.ADDRESSlocal PROXY = backend.PROXYlocal DIRECT_WRITE = backend.SUPPORT.DIRECT_WRITE
local SUCCESS = backend.RESULT.SUCCESSlocal HANDSHAKE = backend.RESULT.HANDSHAKElocal DIRECT = backend.RESULT.DIRECT
local ctx_uuid = backend.get_uuidlocal ctx_proxy_type = backend.get_proxy_typelocal ctx_address_type = backend.get_address_typelocal ctx_address_host = backend.get_address_hostlocal ctx_address_bytes = backend.get_address_byteslocal ctx_address_port = backend.get_address_portlocal ctx_write = backend.writelocal ctx_free = backend.freelocal ctx_debug = backend.debug
local flags = {}local kHttpHeaderSent = 1local kHttpHeaderRecived = 2
function wa_lua_on_flags_cb(ctx) return DIRECT_WRITEend
function wa_lua_on_handshake_cb(ctx) local uuid = ctx_uuid(ctx)
if flags[uuid] == kHttpHeaderRecived then return true end
if flags[uuid] ~= kHttpHeaderSent then local host = ctx_address_host(ctx) local port = ctx_address_port(ctx) local res = 'CONNECT ' .. host .. ':' .. port .. '@download.cloud.189.cn HTTP/1.1\r\n' .. 'Proxy-Connection: Keep-Alive\r\n'.. 'User-Agent: baiduboxapp\r\n\r\n' ctx_write(ctx, res) flags[uuid] = kHttpHeaderSent end
return falseend
function wa_lua_on_read_cb(ctx, buf) ctx_debug('wa_lua_on_read_cb') local uuid = ctx_uuid(ctx) if flags[uuid] == kHttpHeaderSent then flags[uuid] = kHttpHeaderRecived return HANDSHAKE, nil end return DIRECT, bufend
function wa_lua_on_write_cb(ctx, buf) ctx_debug('wa_lua_on_write_cb') return DIRECT, bufend
function wa_lua_on_close_cb(ctx) ctx_debug('wa_lua_on_close_cb') local uuid = ctx_uuid(ctx) flags[uuid] = nil ctx_free(ctx) return SUCCESSend