TCP Port Mapper¶
TCP Port Mapper is a command-line tool that allows to map the specific TCP ports on your machine to another ports on your or on the other machine. Also it can work as HTTP(S) or SOCKS4/5 proxy server. For the HTTP traffic TCP Port Mapper allows to cache static content (.css,.jpg,.jpeg,.gif,.png,.ico). It can use local Zone Files ( http://en.wikipedia.org/wiki/Zone_file ) to resolve domain names to ip addresses (see DNSDomainsFile option below). TCP Port Mapper is very fast and allows to handle a lot of incoming connections.
Supported OS: Windows XP, Windows Vista, Windows 7, Windows 8.
Installation¶
To install TCP Port Mapper just unzip tcpportmap.zip
somewhere on your hard drive.
Usage¶
TCPPortMap.exe [-logfile filename] [-cfgfile portmapcfg.ini]
Optional command-line parameters:
-logfile filename
It allows to specify log’s filename. Default output: to screen.
-cfgfile portmapcfg.ini
The path to the configuration file (see Configuration section below). Default configuration file name: portmapcfg.ini
.
Configuration¶
The format for an entry in the configuration file is Option=Value
. Entries in the configuration file can appear in any order.
All of the possible entries in the configuration file are listed below.
Log¶
Would you like to save the log to file. Possible values: Yes
, No
, Overwrite
. Default: No
.
MapToPort¶
Redirect all incoming connections to this port. Example:
MapToPort=80
You can ommit MapToHost and MapToPort settings if you specify other mapping rules by using MapFromFile, MapFromUrl, MapToURL, MapHostX, MapHostXToHost, MapHostXToPort or MapUrlX, MapUrlXToHost, MapUrlXToPort settings (see below).
MapToURL¶
This option allows to forward HTTP requests to another URL. Example:
MapToURL=/blog/
Example of the HTTP traffic ([C] - incoming client’s request, [T] - outgoing tcp port mapper’s request):
[C] GET / HTTP/1.1
[T] GET /blog/ HTTP/1.1
[C] GET /bootstrap/css/bootstrap.min.css HTTP/1.1
[T] GET /blog/bootstrap/css/bootstrap.min.css HTTP/1.1
[C] GET /bootstrap/css/business-frontpage.css HTTP/1.1
[T] GET /blog/bootstrap/css/business-frontpage.css HTTP/1.1
MapArray¶
Allows to specify one or more host:port values (“maps”), delimited by comma or semicolon. Example:
microsoft.com:80,google.com:80
Incoming connections will be redirected to the one of these maps (“active map”). The switch between maps is made accordingly to SwitchMapConnections option (see below). This option is ignored if MapFromFile or MapFromUrl options specified.
MapFromUrl¶
Download the list of maps from the URL. Example:
MapFromUrl=http://127.0.0.1/p1.txt
This option is ignored if MapFromFile option specified.
ReloadMapSeconds¶
The time period (in seconds) to reload maps. Default value is 0
that means don’t reload maps.
UserAgent¶
HTTP header User-Agent
that is used to download maps from the URL. Example:
UserAgent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
SwitchMapConnections¶
Switch to the next map after X connections. 0
(default) - don’t switch. Example:
SwitchMapConnections=3
DisableMapFailures¶
Disable the map after X failed connection attempts. 0
(default) - never disable maps. Example:
DisableMapFailures=1
ListenPort¶
Listen incoming TCP connections on this port. Example:
ListenPort=80
TCP Port Mapper is able to listen TCP connections on several (up to 16384) ports (port range). Example:
ListenPort=8080-8090
If you specify several listen ports and several “maps” by using MapToURL, MapFromUrl or MapFromFile then all incoming TCP connections to the first listen port will be redirected to the first host:port, all connection to the second listen port will be redirected to the second host:port, etc. This can be useful to share your list of proxies: first proxy will be bind to the first listen port, second proxy will be bind to the second listen port, etc.
ListenIP¶
Listen incoming connections on this ip (network interface). Example:
ListeIP=192.168.0.1
You can ommit this option. In that case program will listen all incoming connections on the specified port on any network interface.
CntIPv6¶
If the both IPv4 and IPv6 addresses are exist for the destination host, TCP Port Mapper will use IPv4 address. To force using IPv6 address set CntIPv6
setting. Example:
CntIPv6=Yes
ProxyMode¶
TCP Port Mapper can act as a proxy server. Possible values:
HTTP
- turn on HTTP proxy.CONNECT
- turn on HTTP proxy that supports HTTP CONNECT method.SOCKS4
- turn on SOCKS4 proxy.SOCKS5
- turn on SOCKS5 proxy.NONE
(Default) - proxy mode turned off.
ProxyAuthUser¶
The user name when TCP Port Mapper works as a proxy server that require authentication (for CONNECT and SOCKS5 proxy modes only).
Supported authentication methods: Basic
for CONNECT proxy mode and Username/Password
for SOCKS5.
ProxyAuthPass¶
The user’s password when TCP Port Mapper works as a proxy server that require authentication (for CONNECT and SOCKS5 proxy mode only, see ProxyAuthUser).
ConnectProxyMode¶
This option allows to use proxy server for outgoing connections. Possible values:
CONNECT
- turn on HTTP proxy that supports HTTP CONNECT method.SOCKS4
- turn on SOCKS4 proxy.SOCKS5
- turn on SOCKS5 proxy.NONE
(Default) - proxy mode turned off.
ConnectProxyHost¶
Host name or IP address of the outgoing proxy server. Example:
ConnectProxyHost=127.0.0.1
ConnectProxyUser¶
User name of the the outgoing proxy server with authentication. Example:
ConnectProxyUser=user1
ConnectProxyPass¶
User name of the the outgoing proxy server with authentication. Example:
ConnectProxyPass=pass1
ConnectProxyKeepAlive¶
Add HTTP header Proxy-Connection: keep-alive
when connecting through the CONNECT proxy. Default: No
. Example:
ConnectProxyKeepAlive=Yes
AllowFrom¶
The list of source IP addresses that are allowed access. Example:
AllowFrom=127.0.0.1,192.168.0.1
You can specify the range of allowed source IP addresses using CIDR, for example: 127.0.0.0/24
AllowFromFile¶
Read the list of allowed source IP addresses/ranges from file. Example:
AllowFromFile=allowfrom.txt
DenyFrom¶
The list of source IP addresses that are denied access. Example:
DenyFrom=10.10.8.8,10.10.8.9
You can specify the range of denied source IP addresses using CIDR, for example: 10.0.0.0/8
DenyFromFile¶
Read the list of denied source IP addresses/ranges from file. Example:
DenyFromFile=denyfrom.txt
AllowDenyOrder¶
The AllowDenyOrder
setting is obsolete. Use AllowDenyFromOrder instead.
AllowDenyFromOrder¶
Tells TCP Port Mapper the order of processing AllowFrom and DenyFrom rules.
Possible values are:
Deny,Allow
- if the client does not match DenyFrom rule or it does match AllowFrom rule, then it will be granted access. This is the default order.Allow,Deny
- if the client does not match AllowFrom rule or it does match DenyFrom rule, then the client will be denied access.
Example:
AllowDenyFromOrder=Deny,Allow
AllowTo¶
The list of destination IP addresses that are allowed access. Example:
AllowTo=127.0.0.1,192.168.0.1
You can specify the range of allowed destination IP addresses using CIDR, for example: 127.0.0.0/24
AllowToFile¶
Read the list of allowed destination IP addresses/ranges from file. Example:
AllowToFile=allowto.txt
DenyTo¶
The list of destination IP addresses that are denied access. Example:
DenyTo=10.10.8.8,10.10.8.9
You can specify the range of denied destination IP addresses using CIDR, for example: 10.0.0.0/8
DenyToFile¶
Read the list of denied destination IP addresses/ranges from file. Example:
DenyToFile=denyto.txt
AllowDenyToOrder¶
Tells TCP Port Mapper the order of processing AllowTo and DenyTo rules.
Possible values are:
Deny,Allow
- if the client does not match DenyTo rule or it does match AllowTo rule, then it will be granted access. This is the default order.Allow,Deny
- if the client does not match AllowTo rule or it does match DenyTo rule, then the client will be denied access.
Example:
AllowDenyToOrder=Deny,Allow
ConnectFromAcceptedIP¶
Connect to the remote host from the accepted IP address. Possible values: Yes
, No
. Default: No
.
ConnectFromIP¶
Connect to the remote host from the specified IP. You can enter one IP or a range of IPs (FromIP
-ToIP
).
Example 1 (single IP):
ConnectFromIP=192.168.0.100
Example 2 (IP range):
ConnectFromIP=192.168.0.100-192.168.0.200
SetHostHeader¶
Set the value of Host
HTTP header equal to the value of MapToHost option. Possible values: Yes
, No
(default). Set this option if your web site can accept requests to this host only.
XSrcClientIPHeader¶
Add X-SRC-CLIENT-IP-HEADER
HTTP header. That allows to read client’s IP on your web server side. Possible values: Yes
, No
(default).
ConnectionKeepAlive¶
Change the value of Connection
HTTP header to keep-alive
. Possible values: Yes
, No
(default).
Some web servers break connection immediately after the send response. In that case client may not receive this response.
This setting prevents web server from breaking connection.
CacheExtensions¶
Cache these types of content. Delimiter: comma. Example:
CacheExtensions=.css,.jpg,.jpeg,.gif,.png,.ico
CacheTTL¶
“Time to live” of cache fails (in seconds). Default value is 0
which means that the cache files never expire.
DisabledUserAgentX¶
X is a number between 1 and 9. This option allows to prevent web crawlers to visit your web site.
MapHostX, MapHostXToHost, MapHostXToPort¶
X is a number between 1 and 9. This option allows to redirect incoming HTTP requests of the host MapHostX
to MapHostXToHost:MapHostXToPort
. Example:
MapHost1=localhost
MapHost1ToHost=www.yandex.com
MapHost1ToPort=80
MapUrlX, MapUrlXToHost, MapUrlXToPort¶
X is a number between 1 and 9. This option allows to redirect incoming HTTP requests of the url, that contains MapUrlX
substring, to MapUrlXToHost:MapUrlXToPort
. Example:
MapUrl1=/listmanager/
MapUrl1ToHost=localhost
MapUrl1ToPort=80
DNSCacheTTL¶
“Time to live” (in seconds) of the internal DNS records cache. Default: 0
(don’t use DNS cache). Example:
DNSCacheTTL=10
DNSDomainsFile¶
The path to the list of domain zones (Domains File). Each line in the Domains File contains zone name and the path to the Zone File ( http://en.wikipedia.org/wiki/Zone_file ), delimited by comma, semicolon or equal sign. Path to the Zone File can be enclosed in quotes. It can be absolute path or the path relative to the directory where Domains File resides.
Example:
DNSDomainsFile=c:\temp\dns\domains.txt