1 /*
2  * Created on 15-Dec-2004
3  * Created by Paul Gardner
4  * Copyright (C) Azureus Software, Inc, All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  */
19 
20 package com.aelitis.azureus.core.proxy;
21 
22 import java.net.InetAddress;
23 import java.net.InetSocketAddress;
24 import java.net.URL;
25 import java.util.Map;
26 
27 /**
28  * @author parg
29  *
30  */
31 
32 public interface
33 AEProxyAddressMapper
34 {
35 	public static final String	MAP_PROPERTY_DISABLE_AZ_MESSAGING	= "AEProxyAddressMapper.disable.az.msg";
36 	public static final String	MAP_PROPERTY_PROTOCOL_QUALIFIER		= "AEProxyAddressMapper.prot.qual";
37 
38 
39 		/**
40 		 * SOCKS 5 is limited to 255 char DNS names. So for longer ones (e.g. I2P 'names')
41 		 * we have to replace then with somethin shorter to get through the SOCKS layer
42 		 * and then remap them on the otherside.
43 		 * These functions are only active if a SOCKS proxy is enabled and looping back
44 		 * (in process is the assumption)
45 		 * @param address
46 		 * @return
47 		 */
48 
49 	public String
internalise( String address )50 	internalise(
51 		String	address );
52 
53 	public String
externalise( String address )54 	externalise(
55 		String	address );
56 
57 	public URL
internalise( URL url )58 	internalise(
59 		URL		url );
60 
61 	public URL
externalise( URL url )62 	externalise(
63 		URL		url );
64 
65 	public PortMapping
registerPortMapping( int local_port, String ip )66 	registerPortMapping(
67 		int		local_port,
68 		String	ip );
69 
70 	public PortMapping
registerPortMapping( int local_port, String ip, Map<String,Object> properties )71 	registerPortMapping(
72 		int						local_port,
73 		String					ip,
74 		Map<String,Object>		properties );
75 
76 	public AppliedPortMapping
applyPortMapping( InetAddress address, int port )77 	applyPortMapping(
78 		InetAddress		address,
79 		int				port );
80 
81 	public interface
82 	PortMapping
83 	{
84 		public void
unregister()85 		unregister();
86 	}
87 
88 	public interface
89 	AppliedPortMapping
90 	{
91 		public InetSocketAddress
getAddress()92 		getAddress();
93 
94 		public Map<String,Object>
getProperties()95 		getProperties();
96 	}
97 }
98