V2Ray has the following commandline parameters:

v2ray [-version] [-test] [-config=config.json] [-format=json]


Print the version of V2Ray only, and then exit.


Test configuration, output any errors and then exit.


URI of the configuration. Avilable formats are:

  • Path to the local config file. May be a relative path or absolute path.
  • "stdin:": Indicates V2Ray to read configuration from standard input. Caller must close stdin after writing out configuration.
  • Value begins with http:// or https:// (lowercase): V2Ray tries to load configuration from the remote address.


Configuration format. Choices are:

  • json: JSON format.
  • pb or protobuf: Protobuf format.

When -config is not specified, V2Ray first tries to load configuration from config.json under working directory, then from the directory specified by environment variable v2ray.location.asset.


V2Ctl is a collection of commandline tools. It runs in the following way:

v2ctl <command> <options>


Subcommand. Available values are below:

  • api: Invoke remote control commands in V2Ray instances.
  • config: Convert configuration from JSON format to protobuf.
  • cert: Generate TLS certificates.
  • fetch: Fetch remove resources.
  • tlsping: (V2Ray 4.17+) Test TLS handshake.
  • verify: Verify the signature of V2Ray releases.
  • uuid: Generate UUID.

V2Ctl Api

v2ctl api [--server=] <Service.Method> <Request>

Invoke remote control commands in V2Ray instances. Example:

v2ctl api --server= LoggerService.RestartLogger ''

V2Ctl Config

v2ctl config

No option for this command. It reads JSON configuration from stdin, and print out corresponding Protobuf to stdout, if succeeds.

V2Ctl Cert

v2ctl cert [--ca] [] [--expire=240h] [--name="V2Ray Inc"] [--org="V2Ray Inc] [--json] [--file=v2ray]

Generates a TLS certificate based on options.


If specified, the certificate will be a CA certificate.


Alternative Names in the certificate. This option can be used multiple times for multiple domains. For example:


Expire date of the certificate. Value is a Golang duration.


Command Name in the certificate.


Orgnization in the certificate.


If specified, the certificate will be printed to stdout in the JSON format that is used in V2Ray.


Prints the certificate into files. When --file=a, two files named a_cert.pem and a_key.pem will be generated.

V2Ctl Fetch

v2ctl fetch <url>

Fetch remove resources and print to stdout. Only HTTP and HTTPS URL are supported.

V2Ctl TlsPing

v2ctl tlsping <domain> --ip=[ip]

Test TLS handlshake with specific domain.


Target domain for the TLS handshake.


The IP address of the domain. If not specifed, V2Ctl resolves it through system DNS.

V2Ctl Verify

v2ctl verify [--sig=/path/to/sigfile] <filepath>

To verify the signature of a V2Ray binary.


Path to signature file. Default value is the ".sig" file to the path to be verified.


The file to be verified.


v2ctl uuid

No options. This command prints a random UUID.