vpn-clistart 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/exe/vpn +5 -0
  3. data/lib/vpn_clistart.rb +78 -0
  4. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b68d2cb840fedf1363ceb0233d52e28b57aea3671f2ec671a248ab28c04df8c7
4
+ data.tar.gz: e50f171b4499fe900bc7fcb6a459fba80438f94f63fc7650a492f1791bcc3119
5
+ SHA512:
6
+ metadata.gz: 3e5d3f0e37b359927c31024415641308792966247155fa5b68f8c42943f9366e4d4bd1c2f49700e583ac2f0eaf00fc79f7c6d103d8598c145b89fdc869acf441
7
+ data.tar.gz: 62059b89427726db4ed9f541c841bd5b017a52740b9a877938b986ab159c5efa61c7c5977c606b91d419cda90a496ac616fd3cab2618779966d4dda160e02af9
data/exe/vpn ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "vpn_clistart"
4
+
5
+ VPNClistart.run(ARGV)
@@ -0,0 +1,78 @@
1
+ require "net/http"
2
+ require "json"
3
+ require "uri"
4
+
5
+ module VPNClistart
6
+ BASE = "https://vpn-gateway--jdjdjdjdjdh8288.replit.app"
7
+
8
+ def self.run(argv)
9
+ case argv[0]
10
+ when "help", nil
11
+ help
12
+ when "list"
13
+ list
14
+ when "start"
15
+ start(argv[1])
16
+ when "disconnect"
17
+ disconnect
18
+ else
19
+ puts "Unknown command. Use: vpn help"
20
+ end
21
+ end
22
+
23
+ def self.help
24
+ puts <<~TXT
25
+ VPN CLI Commands:
26
+
27
+ vpn list
28
+ vpn start US
29
+ vpn disconnect
30
+ vpn help
31
+ TXT
32
+ end
33
+
34
+ def self.list
35
+ res = Net::HTTP.get_response(URI("#{BASE}/api/vpn/countries"))
36
+
37
+ if res.is_a?(Net::HTTPSuccess)
38
+ JSON.parse(res.body).each do |c|
39
+ puts "#{c["code"]} #{c["flagEmoji"]} #{c["name"]}"
40
+ end
41
+ else
42
+ puts "Error: #{res.code}"
43
+ end
44
+ end
45
+
46
+ def self.start(country)
47
+ if country.nil?
48
+ puts "Usage: vpn start <COUNTRY_CODE>"
49
+ return
50
+ end
51
+
52
+ uri = URI("#{BASE}/api/vpn/connect")
53
+
54
+ http = Net::HTTP.new(uri.host, uri.port)
55
+ http.use_ssl = true
56
+
57
+ req = Net::HTTP::Post.new(uri)
58
+ req["Content-Type"] = "application/json"
59
+ req.body = { countryCode: country.upcase }.to_json
60
+
61
+ res = http.request(req)
62
+ puts res.body
63
+ end
64
+
65
+ def self.disconnect
66
+ uri = URI("#{BASE}/api/vpn/disconnect")
67
+
68
+ http = Net::HTTP.new(uri.host, uri.port)
69
+ http.use_ssl = true
70
+
71
+ req = Net::HTTP::Post.new(uri)
72
+ req["Content-Type"] = "application/json"
73
+ req.body = {}.to_json
74
+
75
+ res = http.request(req)
76
+ puts res.body
77
+ end
78
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vpn-clistart
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - YourName
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2026-07-03 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Start, list and disconnect VPN servers from CLI
13
+ email:
14
+ - you@example.com
15
+ executables:
16
+ - vpn
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - exe/vpn
21
+ - lib/vpn_clistart.rb
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.6.2
40
+ specification_version: 4
41
+ summary: VPN CLI tool
42
+ test_files: []