Skip to content

Instantly share code, notes, and snippets.

@DuckSoft
Last active June 2, 2023 00:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuckSoft/ca03913b0a26fc77a1da4d01cc6ab2f1 to your computer and use it in GitHub Desktop.
Save DuckSoft/ca03913b0a26fc77a1da4d01cc6ab2f1 to your computer and use it in GitHub Desktop.
NaiveProxy URI Specification

Basic

  • NaiveProxy URIs should be standard URIs, not something using JSON and Base64 encoding, etc.
  • https / quic schemes shouldn't be used directly, since they can be confusing with the real protocols.

Rules

  • schema := naive+https | naive+quic
  • username, password := basic auth info. when there's no auth, omit both.
  • host := target host
  • port can be omitted if it's 443, or specify it explicitly
  • queries:
    • padding := 'true' | 'false' - whether to use padding or not. when omitted, use 'false' as default.
    • extra-headers := encodeURIComponent((HEADER ':' VALUE)?( '\0d\0a' HEADER ':' VALUE)*) - extra headers to add, where:
      • HEADER is a random combination of !#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz|~;
      • VALUE is a random string without \0d, \0a and \00.
  • fragment: used to place descriptive texts

Examples

  • naive+https://what:happened@test.someone.cf?padding=false#Naive!
  • naive+https://some.public.rs?padding=true#Public-01
  • naive+quic://manhole:114514@quic.test.me
  • naive+https://some.what?extra-headers=X-Username%3Auser%0D%0AX-Password%3Apassword

Application

Launchers simply strip naive+ from the scheme part, strip and parse the url queries for extra arguments, and strip fragment as optional descriptive text. Afterwards, he/she can directly pass this stripped uri following --proxy= in NaiveProxy argument list. After adding extra arguments like --padding and --extra-headers, NaiveProxy is ready to go.

This URI can also be used in subscriptions, when mixed with other protocols, this scheme is easily distinguishable since we have a prefix naive+. This allows further parsing of the subscribed hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment