socksify 1.8.0 → 1.8.1

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: c9c9f42d889fe8506efd5c6d7bbd13484e6dfed208ac5d125cfeb661a7f03d1d
4
- data.tar.gz: fdb78e9915cb13f17325173d721df354896fb085f82da79a1f7fb2a73b0f8076
3
+ metadata.gz: 78b04ded20de21f0dc44eedde301fab64de043f70a24c5108b64f36d443d57d5
4
+ data.tar.gz: 9a704c1a8e8fa005516ca0f09017b340e5286cf48b2c2ce850eea33f9d553dfa
5
5
  SHA512:
6
- metadata.gz: 5b15e3c4c7b72a03386d0a3f78472d659a44cddd5c9f846d57fc97e3c149a5cedde40958ec78de01a3ac4cb0f828f23f5f7b79adfc4c6d66501973e630f8bb2c
7
- data.tar.gz: 2717aac706890dd74854a02dac6c714aebf3f54d26861144dfa32b6d684965e95d1e1aa4c8f078748fd92d28085a6dbd7495957ea65254bbdbba2bf92e9e8609
6
+ metadata.gz: 75687e942bbf189206db0b531194f2bb6386c5ade89bd80acbe98e9aa0813547506f75900442849f6854c509807f7ab0de733b4cd9380699ea5efd9af61bda59
7
+ data.tar.gz: 2902015d0342ab1ef74fcfb8f20760a0c4a2e8128128448f60794614ecbd8e4de0a21465d371f6b2d5e741a6bd423cd4dd272f6effa18a112085bae55b496d61
data/bin/socksify_ruby CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  if ARGV.size < 2
4
5
  puts "Usage: #{$PROGRAM_NAME} <SOCKS host> <SOCKS port> [script args ...]"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # namespace
2
4
  module Socksify
3
5
  # rubocop:disable Style/Documentation
data/lib/socksify/http.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2007 Stephan Maka <stephan@spaceboyz.net>
2
4
  # Copyright (C) 2011 Musy Bite <musybite@gmail.com>
3
5
  #
@@ -69,20 +69,20 @@ module Socksproxyable
69
69
  # rubocop:disable Metrics
70
70
  def socks_connect(host, port)
71
71
  port = Socket.getservbyname(port) if port.is_a?(String)
72
- req = String.new
72
+ req = +''
73
73
  Socksify.debug_debug 'Sending destination address'
74
74
  req << TCPSocket.socks_version_hex
75
75
  Socksify.debug_debug TCPSocket.socks_version_hex.unpack 'H*'
76
76
  req << "\001"
77
77
  req << "\000" if self.class.socks_version == '5'
78
- req << [port].pack('n') if self.class.socks_version =~ /^4/
78
+ req << [port].pack('n') if /^4/.match?(self.class.socks_version)
79
79
  host = Resolv::DNS.new.getaddress(host).to_s if self.class.socks_version == '4'
80
80
  Socksify.debug_debug host
81
81
  if host =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ # to IPv4 address
82
82
  req << "\001" if self.class.socks_version == '5'
83
83
  ip = (1..4).map { |i| Regexp.last_match(i).to_i }.pack('CCCC')
84
84
  req << ip
85
- elsif host =~ /^[:0-9a-f]+$/ # to IPv6 address
85
+ elsif /^[:0-9a-f]+$/.match?(host) # to IPv6 address
86
86
  raise 'TCP/IPv6 over SOCKS is not yet supported (inet_pton missing in Ruby & not supported by Tor'
87
87
  # req << "\004" # UNREACHABLE
88
88
  elsif self.class.socks_version == '5' # to hostname
@@ -133,7 +133,7 @@ module Socksproxyable
133
133
  i = 0
134
134
  ip6 = ''
135
135
  bind_addr_s.each_byte do |b|
136
- ip6 += ':' if i > 0 && i.even?
136
+ ip6 += ':' if i.positive? && i.even?
137
137
  i += 1
138
138
  ip6 += b.to_s(16).rjust(2, '0')
139
139
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'socksproxyable'
2
4
 
3
5
  # monkey patch
@@ -70,7 +72,7 @@ class TCPSocket
70
72
  def make_socks_connection(host, port, **kwargs)
71
73
  Socksify.debug_notice "Connecting to SOCKS server #{socks_server}:#{socks_port}"
72
74
  initialize_tcp socks_server, socks_port, **kwargs
73
- socks_authenticate(socks_username, socks_password) unless @socks_version =~ /^4/
75
+ socks_authenticate(socks_username, socks_password) unless /^4/.match?(@socks_version)
74
76
  socks_connect(host, port) if host
75
77
  end
76
78
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # namespace
4
4
  module Socksify
5
- VERSION = '1.8.0'
5
+ VERSION = '1.8.1'
6
6
  end
data/lib/socksify.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: us-ascii
2
+ # frozen_string_literal: true
2
3
 
3
4
  # Copyright (C) 2007 Stephan Maka <stephan@spaceboyz.net>
4
5
  #
@@ -119,7 +120,7 @@ module Socksify
119
120
  end
120
121
 
121
122
  def self.request(host)
122
- req = String.new << "\005"
123
+ req = (+'') << "\005"
123
124
  case host
124
125
  when /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ # to IPv4 address
125
126
  req << "\xF1\000\001#{(1..4).map { |i| Regexp.last_match(i).to_i }.pack('CCCC')}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socksify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Maka
@@ -12,7 +12,7 @@ authors:
12
12
  - David Dollar
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2025-07-17 00:00:00.000000000 Z
15
+ date: 2025-07-20 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  email: stephan@spaceboyz.net
18
18
  executables:
@@ -47,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '2.0'
50
+ version: '2.7'
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="