Sha256: b2ac94c04fcd0633196449bb6408bbf71dcdb2c0a19151186ec7096bb472c80a

Contents?: true

Size: 948 Bytes

Versions: 11

Compression:

Stored size: 948 Bytes

Contents

# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/api/communication/socket'

module Contrast
  module Api
    module Communication
      # This class allows us to create a TCP Socket to communicate to the Service
      # (Speed Racer). Either it or the Unix Socket will be used, as determined
      # by the configuration options set for Service communication.
      class TcpSocket
        include Contrast::Api::Communication::Socket

        attr_reader :host, :port

        # Create the socket
        # @param host [String] socket target hostname or IP address
        # @param port [String,Integer] socket target port
        def initialize host, port
          @host = host.to_s
          @port = port.to_i
        end

        def new_socket
          ::TCPSocket.new(host, port)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
contrast-agent-4.13.1 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.13.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.12.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.11.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.10.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.9.1 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.9.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.8.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.7.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.6.0 lib/contrast/api/communication/tcp_socket.rb
contrast-agent-4.5.0 lib/contrast/api/communication/tcp_socket.rb