Sha256: 0af7e85576abeed0a2132908dd408c093414cdc3ed3a28605f1e4af1ffcf2d66

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 KB

Contents

module VagrantPlugins
  module ProviderVirtualBox
    module Model
      # Represents a single forwarded port for VirtualBox. This has various
      # helpers and defaults for a forwarded port.
      class ForwardedPort
        # The NAT adapter on which to attach the forwarded port.
        #
        # @return [Integer]
        attr_reader :adapter

        # If true, this port should be auto-corrected.
        #
        # @return [Boolean]
        attr_reader :auto_correct

        # The unique ID for the forwarded port.
        #
        # @return [String]
        attr_reader :id

        # The protocol to forward.
        #
        # @return [String]
        attr_reader :protocol

        # The port on the guest to be exposed on the host.
        #
        # @return [Integer]
        attr_reader :guest_port

        # The port on the host used to access the port on the guest.
        #
        # @return [Integer]
        attr_reader :host_port

        def initialize(id, host_port, guest_port, options)
          @id         = id
          @guest_port = guest_port
          @host_port  = host_port

          options ||= {}
          @auto_correct = true
          @auto_correct = options[:auto_correct] if options.has_key?(:auto_correct)
          @adapter  = options[:adapter] || 1
          @protocol = options[:protocol] || "tcp"
        end

        # This corrects the host port and changes it to the given new port.
        #
        # @param [Integer] new_port The new port
        def correct_host_port(new_port)
          @host_port = new_port
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
vagrantup-1.1.2 plugins/providers/virtualbox/model/forwarded_port.rb
vagrantup-1.1.1 plugins/providers/virtualbox/model/forwarded_port.rb
vagrantup-1.1.0 plugins/providers/virtualbox/model/forwarded_port.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/providers/virtualbox/model/forwarded_port.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/providers/virtualbox/model/forwarded_port.rb