-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some fix and small features #961
base: dev
Are you sure you want to change the base?
Conversation
gRPC is changes in latest versions of Xray-core, check this : XTLS/Xray-core#1815 There is 3 different type of gRPC server configs : And network name for gRPC can be 'grpc' or 'gun' |
ok so we can have this type of grpc with |
network 'gun' and network 'grpc' are same thing, one transport with multiple aliases |
done. |
Please revert "feat: support gRPC Custom Path", it's wrong We must check if path is started with "/" or not But if it's started with "/" we must split it in serviceName and streamName(Gun) and streamName(Multi) now for Xray based clients we must send the full path ("/custom/path/GunCustomPath|MultiCustomPath") And when user uses this type of Path for gRPC, it does not mean MultiMode is Enabled, it could be disabled For Clash.Meta and Sing-Box Gun mode will only work if streamName(Gun) is euqal to "Tun" |
You can add randomUserAgent function to the new function file import random
# Source: https://cdn.jsdelivr.net/gh/microlinkhq/top-user-agents@master/src/index.json
UserAgentList = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
]
def genRandUserAgent():
return random.choice(UserAgentList)
print(genRandUserAgent()) You can add all 100 user agents from the url and update user agent list later too, but making many requests to jsdelivr cdn is not good, they may have or add a rate limit or block our server's ip gRPC supports custom user-agent too, with user agent and authority of grpc we can use it with no tls and remain undetected |
this is what they provide as a sample server side :
client without multi:
client with multi tun:
if you don't want to use multi mode without conflict with not xray based client you can just use normal grpc i'm not sure what you what you mean by urlEncode , we have different type of that |
check this : def get_grpc_gun(input: str):
if not input.startswith("/"):
return input
servicename = input.rsplit("/", 1)[0]
streamname = input.rsplit("/", 1)[1].split("|")[0]
if streamname == "Tun":
return servicename[1:]
return "%s%s%s" % (servicename, "/", streamname)
def get_grpc_multi(input: str):
if not input.startswith("/"):
return input
servicename = input.rsplit("/", 1)[0]
streamname = input.rsplit("/", 1)[1].split("|")[1]
return "%s%s%s" % (servicename, "/", streamname)
print(get_grpc_gun("oldPath"))
print(get_grpc_gun("/newPath/Tun|MultiCustomPath"))
print(get_grpc_gun("/new/path/GunCustomPath|MultiCustomPath"))
print(get_grpc_multi("oldPath"))
print(get_grpc_multi("/new/path/GunCustomPath|MultiCustomPath"))
In xray-core tag 1.8.9 written from urllib.parse import quote
print(quote("/my/path", safe="-_.!~*'()")) |
so for not xray based clients we use get_grpc_gun and for xray based if multimode was enable we use get_grpc_multi? |
and i can't find any user agent option for grpc |
exactly
They added it in https://github.com/XTLS/Xray-core/pull/1790/files |
i fix grpc and add encode for service name start with / |
fix:
feat:
refactor: