mullvadrb 0.0.6 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62025cd992ac7eb3131759b79871deac11d0005d138bc859ac0d25bce2cc0cc5
4
- data.tar.gz: '0458bee533857011a1f195b710119c9f2e69a9d78a6051b01be9ff6da61834ba'
3
+ metadata.gz: 636dfebb481d356dca100281f92e627df90af8956116cc546a332e53ae9fdffe
4
+ data.tar.gz: 820ba7d690bf9a9bd12e6b4211caabba820cd4d783a9798df3fed8dc978d2323
5
5
  SHA512:
6
- metadata.gz: ab28e8cbbba0b1bb7428c9bc5ad2e2878cd55f3321dd081c0d16dc2222fb2e0840e196ff3ab08302a75bb2e0a9b2e3c196ecb2ce74e75b94d121128005aa1307
7
- data.tar.gz: e8a804c0c70e5b9fd1e15cfe9a1b2c87af1d72616601ccdde35f57f63bf7fbd868ce5bf838023fef028081444f43a2bd682d557ae7f879fbd634be82c702e1e0
6
+ metadata.gz: a32e2dc8e0e47f5faec592718e614af95b9f1c6001e82677f84439c7eff2f176d2dcbcb740b88fe735d1cb1365acab3e2dbcb561eeeba981f4da0897aec0ec63
7
+ data.tar.gz: 99fb2637205a6c3be55f72f21614b7a3b573e9c2d2afb0d5b0133077df21d9d9f5813cdce4bd28310f6c7be85bebb6819172cf803127b803ba972f9062d140ee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.0.8
2
+
3
+ - Better status format and message for blocked connection.
4
+ - Adds allowing LAN access through mullvad-cli.
5
+
6
+ # 0.0.7
7
+
8
+ - Fixes settings configuration, updates Settings code.
9
+
1
10
  # 0.0.6
2
11
 
3
12
  - Adds DNS Blockers functionality.
@@ -7,7 +7,7 @@ en:
7
7
  change_backend: "Change backend"
8
8
  choose_country: "Choose country"
9
9
  choose_specific: "Choose specific"
10
- connected: "📡 Connected \n"
10
+ connected: "📡 ✅ Connected"
11
11
  connecting: "📞 Connecting ☎ \n"
12
12
  connecting_to: "Connecting to %{server}"
13
13
  devices: "Devices"
@@ -33,3 +33,4 @@ en:
33
33
  language_es: "Spanish"
34
34
  dns_blockers: "DNS Blockers"
35
35
  dns_blockers_menu: "DNS Blockers - Press Enter↲ to confirm:"
36
+ lan: "Enable LAN access"
@@ -7,7 +7,7 @@ es:
7
7
  change_backend: "Cambiar backend"
8
8
  choose_country: "Elegir país"
9
9
  choose_specific: "Elegir específico"
10
- connected: "📡 Conectado \n"
10
+ connected: "📡 ✅ Conectado"
11
11
  connecting: "📞 Conectando ☎ \n"
12
12
  connecting_to: "Conectándose a %{server}"
13
13
  devices: "Dispositivos"
@@ -33,3 +33,4 @@ es:
33
33
  language_es: "Español"
34
34
  dns_blockers: "Bloqueadores DNS"
35
35
  dns_blockers_menu: "Bloqueadores DNS - Presiona Enter↲ para confirmar:"
36
+ lan: "Habilitar acceso LAN"
@@ -11,6 +11,7 @@ module Mullvadrb
11
11
 
12
12
  def devices
13
13
  puts `mullvad account list-devices`
14
+ puts
14
15
  end
15
16
  end
16
17
  end
@@ -50,5 +50,10 @@ module Mullvadrb
50
50
  Mullvadrb::Connection.connect
51
51
  end
52
52
  end
53
+
54
+ def lan
55
+ puts `mullvad lan set allow`
56
+ puts
57
+ end
53
58
  end
54
59
  end
@@ -1,3 +1,5 @@
1
+ require 'countries'
2
+
1
3
  module Mullvadrb
2
4
  #
3
5
  # Manage Mullvad connect, disconnect and status
@@ -31,12 +33,15 @@ module Mullvadrb
31
33
  status.gsub!('Disconnected', I18n.t(:disconnected))
32
34
  .gsub!(/$/, "\n")
33
35
  elsif status.start_with?('Connected')
34
- status = status.split("\n")
35
- .sort
36
- .reject { |a| a == 'Connected' }
37
- .prepend(I18n.t(:connected))
36
+ status = status.split("\n").reject { |a| a == 'Connected' }
37
+ country_name = status.find { |a| a.match?('Visible location') }.split("\s")[2].gsub(',','')
38
+ country = ISO3166::Country.find_country_by_any_name(country_name)
39
+ status = status.prepend("#{I18n.t(:connected)} to #{country.emoji_flag} #{country.common_name}\n")
38
40
  .push("\n")
39
41
  .join("\n")
42
+ # Blocked: Failure to generate tunnel parameters: Failure to select a matching tunnel relay
43
+ elsif status.start_with?('Blocked')
44
+ status.prepend("\n🚧 ").concat("\n")
40
45
  elsif status.start_with?('Connecting')
41
46
  status = status.split("\n")
42
47
  .sort
@@ -19,9 +19,9 @@ module Mullvadrb
19
19
  else
20
20
  regexp = /\(([a-z]{2})\)/ # Country (xx) - Country name + code and group code
21
21
  flag = s.match(regexp)[1]
22
- .upcase
23
- .codepoints
24
- .map { |c| (c + 127397).chr('utf-8') }.join
22
+ .upcase
23
+ .codepoints
24
+ .map { |c| (c + 127_397).chr('utf-8') }.join
25
25
  country = s.gsub(regexp, '').strip
26
26
  next
27
27
  end
@@ -2,53 +2,51 @@ module Mullvadrb
2
2
  module Settings
3
3
  CONFIG_FILE = File.expand_path('~/.local/share/mullvadrb/mullvadrb.yml').freeze
4
4
 
5
- class << self
6
- def load_config
7
- return unless File.exist?(CONFIG_FILE)
5
+ def load_config
6
+ return unless File.exist?(CONFIG_FILE)
8
7
 
9
- config_file = YAML.load(File.read(CONFIG_FILE))
10
- @backend = config_file[:backend]
11
- @locale = config_file[:locale]
12
- @wg = (@backend == 'wg')
13
- load_servers unless @wg
14
- require 'mullvadrb/wg_manager' if @wg
15
- end
8
+ config_file = YAML.load(File.read(CONFIG_FILE))
9
+ @backend = config_file[:backend]
10
+ @locale = config_file[:locale]
11
+ @wg = (@backend == 'wg')
12
+ load_servers unless @wg
13
+ require 'mullvadrb/wg_manager' if @wg
14
+ end
16
15
 
17
- def save_config!
18
- dir = File.expand_path('~/.local/share/mullvadrb/')
19
- system 'mkdir', '-p', dir unless File.exist?(dir)
20
- config = {
21
- backend: @backend,
22
- locale: @locale || I18n.locale
23
- }
24
- File.open(CONFIG_FILE, 'w+') do |f|
25
- f.write(config.to_yaml)
26
- end
16
+ def save_config!
17
+ dir = File.expand_path('~/.local/share/mullvadrb/')
18
+ system 'mkdir', '-p', dir unless File.exist?(dir)
19
+ config = {
20
+ backend: @backend,
21
+ locale: @locale || I18n.locale
22
+ }
23
+ File.open(CONFIG_FILE, 'w+') do |f|
24
+ f.write(config.to_yaml)
27
25
  end
26
+ end
28
27
 
29
- def load_servers
30
- @servers = Mullvadrb::Servers.servers
31
- end
28
+ def load_servers
29
+ @servers = Mullvadrb::Servers.servers
30
+ end
32
31
 
33
- def ask_backend
34
- backend = TTY::Prompt.new.select(I18n.t(:backend_which), cycle: true) do |menu|
35
- menu.choice name: I18n.t(:backend_wg), value: 'wg'
36
- menu.choice name: I18n.t(:backend_mullvad), value: 'mullvad'
37
- end
38
- @wg = (backend == 'wg')
39
- require 'mullvadrb/wg_manager' if @wg
40
- backend
32
+ def ask_backend
33
+ backend = TTY::Prompt.new.select(I18n.t(:backend_which), cycle: true) do |menu|
34
+ menu.choice name: I18n.t(:backend_wg), value: 'wg'
35
+ menu.choice name: I18n.t(:backend_mullvad), value: 'mullvad'
41
36
  end
37
+ @wg = (backend == 'wg')
38
+ require 'mullvadrb/wg_manager' if @wg
39
+ backend
40
+ end
42
41
 
43
- def languages
44
- language = TTY::Prompt.new.select(I18n.t(:language_which), cycle: true) do |menu|
45
- menu.choice name: I18n.t(:language_en), value: 'en'
46
- menu.choice name: I18n.t(:language_es), value: 'es'
47
- end
48
- @locale = language.to_sym
49
- I18n.locale = @locale
50
- save_config!
42
+ def languages
43
+ language = TTY::Prompt.new.select(I18n.t(:language_which), cycle: true) do |menu|
44
+ menu.choice name: I18n.t(:language_en), value: 'en'
45
+ menu.choice name: I18n.t(:language_es), value: 'es'
51
46
  end
47
+ @locale = language.to_sym
48
+ I18n.locale = @locale
49
+ save_config!
52
50
  end
53
51
  end
54
52
  end
@@ -30,7 +30,13 @@ module Mullvadrb
30
30
  def specific
31
31
  connections = CONNECTIONS.map { |c| { name: "#{c[:value]} #{c[:name]}", value: c[:value] } }
32
32
  connect(
33
- TTY::Prompt.new.select('Select configuration file', connections, cycle: true, per_page: 30, filter: true)
33
+ TTY::Prompt.new.select(
34
+ 'Select configuration file',
35
+ connections,
36
+ cycle: true,
37
+ per_page: 30,
38
+ filter: true
39
+ )
34
40
  )
35
41
  end
36
42
 
data/lib/mullvadrb.rb CHANGED
@@ -17,15 +17,16 @@ module Mullvadrb
17
17
  # Main object instantiated, saves backend, i18n if set, and persists.
18
18
  class Main
19
19
  include Mullvadrb::CommandManager
20
+ include Mullvadrb::Settings
20
21
 
21
22
  def initialize
22
23
  # To determine if we're using WireGuard or mullvad cli, attempt to load a pre-saved
23
24
  # configuration or prompt the user which one to use:
24
- Mullvadrb::Settings.load_config
25
+ load_config
25
26
  @backend ||= Mullvadrb::Settings.ask_backend
26
27
  puts I18n.t(:backend_using, backend: @backend)
27
28
  I18n.locale = @locale || I18n.default_locale
28
- Mullvadrb::Settings.save_config!
29
+ save_config!
29
30
  puts Mullvadrb::Connection.status
30
31
  end
31
32
 
@@ -45,7 +46,8 @@ module Mullvadrb
45
46
  "🔌 #{I18n.t(:disconnect)}" => 'disconnect',
46
47
  "⚙ #{I18n.t(:change_backend)}" => 'backend',
47
48
  "🗣 #{I18n.t(:languages)}" => 'languages',
48
- "📟 #{I18n.t(:dns_blockers)}" => 'dns_blockers'
49
+ "📟 #{I18n.t(:dns_blockers)}" => 'dns_blockers',
50
+ "📞 #{I18n.t(:lan)}" => 'lan'
49
51
  }
50
52
  end
51
53
 
@@ -65,10 +67,10 @@ module Mullvadrb
65
67
  exit if selection == 'exit'
66
68
 
67
69
  case selection
68
- when 'status', 'disconnect', 'country', 'specific', 'random'
70
+ when 'status', 'disconnect', 'country', 'specific', 'random', 'lan'
69
71
  send(selection)
70
72
  when 'backend'
71
- Mullvadrb::Settings.ask_backend
73
+ ask_backend
72
74
  # Only when using mullvad cli and not wg:
73
75
  when 'update_servers'
74
76
  Mullvadrb::Servers.update
@@ -81,7 +83,7 @@ module Mullvadrb
81
83
  when 'account_devices'
82
84
  Mullvadrb::Account.devices
83
85
  when 'languages'
84
- Mullvadrb::Settings.languages
86
+ languages
85
87
  when 'dns_blockers'
86
88
  Mullvadrb::DNS.blockers
87
89
  end
data/mullvadrb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mullvadrb'
3
- s.version = '0.0.6'
3
+ s.version = '0.0.8'
4
4
  s.summary = 'A TUI to use with Mullvad VPN'
5
5
  s.description = 'A Terminal User Interface to use with Mullvad VPN'
6
6
  s.authors = ['Fernando Briano']
@@ -11,10 +11,11 @@ Gem::Specification.new do |s|
11
11
  s.license = 'GPL-3.0-only'
12
12
  s.required_ruby_version = '>= 3.0'
13
13
  s.executables << 'mullvadrb'
14
- s.add_dependency 'countries'
14
+ s.add_dependency 'countries', '~> 7'
15
15
  s.add_dependency 'i18n', '~> 1'
16
- s.add_dependency 'tty-prompt'
16
+ s.add_dependency 'tty-prompt', '~> 0.23'
17
17
  s.metadata = {
18
+ 'homepage_uri' => 'https://github.com/picandocodigo/mullvadrb/',
18
19
  'bug_tracker_uri' => 'https://github.com/picandocodigo/mullvadrb/issues',
19
20
  'changelog_uri' => 'https://github.com/picandocodigo/mullvadrb/blob/master/CHANGELOG.md',
20
21
  'source_code_uri' => 'https://github.com/picandocodigo/mullvadrb'
metadata CHANGED
@@ -1,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mullvadrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Briano
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-13 00:00:00.000000000 Z
10
+ date: 2025-08-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: countries
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: '7'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: '7'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: i18n
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -41,16 +41,16 @@ dependencies:
41
41
  name: tty-prompt
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '0.23'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '0.23'
54
54
  description: A Terminal User Interface to use with Mullvad VPN
55
55
  email: fernando@picandocodigo.net
56
56
  executables:
@@ -79,6 +79,7 @@ homepage: https://github.com/picandocodigo/mullvad-ruby
79
79
  licenses:
80
80
  - GPL-3.0-only
81
81
  metadata:
82
+ homepage_uri: https://github.com/picandocodigo/mullvadrb/
82
83
  bug_tracker_uri: https://github.com/picandocodigo/mullvadrb/issues
83
84
  changelog_uri: https://github.com/picandocodigo/mullvadrb/blob/master/CHANGELOG.md
84
85
  source_code_uri: https://github.com/picandocodigo/mullvadrb