lib/sockit.rb in sockit-0.0.2 vs lib/sockit.rb in sockit-0.0.4
- old
+ new
@@ -1,5 +1,25 @@
+################################################################################
+#
+# Author: Zachary Patten <zachary@jovelabs.net>
+# Copyright: Copyright (c) Zachary Patten
+# License: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
require "socket"
require "resolv"
require "sockit/version"
@@ -134,13 +154,12 @@
end
end
alias :initialize_tcp :initialize
def initialize(remote_host, remote_port, local_host=nil, local_port=nil)
- if (socks.host && socks.port && !socks.ignore.include?(remote_host))
+ if (socks.host && socks.port && !socks.ignore.flatten.include?(remote_host))
Sockit.debug(:yellow, "Connecting to SOCKS server #{socks.host}:#{socks.port}")
initialize_tcp(socks.host, socks.port)
-
(socks.version.to_i == 5) and socks_authenticate
socks.host and socks_connect(remote_host, remote_port)
Sockit.debug(:green, "Connected to #{remote_host}:#{remote_port} via SOCKS server #{socks.host}:#{socks.port}")
else
Sockit.debug(:yellow, "Directly connecting to #{remote_host}:#{remote_port}")