| 1 | /* Copyright 2008 Bernhard R. Fischer, Daniel Haslinger. |
|---|
| 2 | * |
|---|
| 3 | * This file is part of OnionCat. |
|---|
| 4 | * |
|---|
| 5 | * OnionCat is free software: you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation, version 3 of the License. |
|---|
| 8 | * |
|---|
| 9 | * OnionCat is distributed in the hope that it will be useful, |
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | * GNU General Public License for more details. |
|---|
| 13 | * |
|---|
| 14 | * You should have received a copy of the GNU General Public License |
|---|
| 15 | * along with OnionCat. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | */ |
|---|
| 17 | |
|---|
| 18 | #ifndef OCAT_NETDESC_H |
|---|
| 19 | #define OCAT_NETDESC_H |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | #include "ocat.h" |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | //! This structure contains information that's specifc for an anonymization |
|---|
| 26 | // network. |
|---|
| 27 | struct NetDesc |
|---|
| 28 | { |
|---|
| 29 | struct in6_addr prefix; |
|---|
| 30 | int prefix_len; |
|---|
| 31 | struct in_addr prefix4; |
|---|
| 32 | int addr4_mask; |
|---|
| 33 | int name_size; |
|---|
| 34 | char *domain; |
|---|
| 35 | short listen_port; |
|---|
| 36 | short ctrl_port; |
|---|
| 37 | short vdest_port; |
|---|
| 38 | short socks_port; |
|---|
| 39 | char *clog_file; |
|---|
| 40 | char *pid_file; |
|---|
| 41 | char *config_file; |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | extern const struct NetDesc netdesc_[2]; |
|---|
| 45 | |
|---|
| 46 | #define NDESC(x) (netdesc_[CNF(net_type)].x) |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | // ----- these are #defines for Tor ----- |
|---|
| 50 | // |
|---|
| 51 | //! TOR prefix: FD87:D87E:EB43::/48 |
|---|
| 52 | #define TOR_PREFIX {{{0xfd,0x87,0xd8,0x7e,0xeb,0x43,0,0,0,0,0,0,0,0,0,0}}} |
|---|
| 53 | #define TOR_PREFIX_LEN 48 |
|---|
| 54 | #if BYTE_ORDER == LITTLE_ENDIAN |
|---|
| 55 | #ifdef __sun__ |
|---|
| 56 | #define TOR_PREFIX4 {{{0x0000000a}}} |
|---|
| 57 | #else |
|---|
| 58 | #define TOR_PREFIX4 {0x0000000a} |
|---|
| 59 | #endif |
|---|
| 60 | #define TOR_PREFIX4_MASK 0x000000ff |
|---|
| 61 | #else |
|---|
| 62 | #ifdef __sun__ |
|---|
| 63 | #define TOR_PREFIX4 {{{0x0a000000}}} |
|---|
| 64 | #else |
|---|
| 65 | #define TOR_PREFIX4 {0x0a000000} |
|---|
| 66 | #endif |
|---|
| 67 | #define TOR_PREFIX4_MASK 0xff000000 |
|---|
| 68 | #endif |
|---|
| 69 | //! internal domain |
|---|
| 70 | #define TOR_DOMAIN ".onion" |
|---|
| 71 | //! Total length of .onion-URL |
|---|
| 72 | #define TOR_ONION_NAME_SIZE (ONION_URL_LEN + 7) |
|---|
| 73 | //! Local listening port for incoming connections from TOR. |
|---|
| 74 | #define TOR_OCAT_LISTEN_PORT 8060 |
|---|
| 75 | //! Local control port for querying status information. |
|---|
| 76 | #define TOR_OCAT_CTRL_PORT 8066 |
|---|
| 77 | //! Virtual destination port for hidden services |
|---|
| 78 | #define TOR_OCAT_DEST_PORT 8060 |
|---|
| 79 | //! SOCKS port of TOR proxy |
|---|
| 80 | #define TOR_SOCKS_PORT 9050 |
|---|
| 81 | #define TOR_OCAT_CONNECT_LOG "ocat_connect_log" |
|---|
| 82 | #define TOR_PID_FILE "/var/run/ocat.pid" |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | // ----- these are #defines for I2P ----- |
|---|
| 86 | // |
|---|
| 87 | //! TOR prefix: FD60:DB4D:DDB5::/48 |
|---|
| 88 | #define I2P_PREFIX {{{0xfd,0x60,0xdb,0x4d,0xdd,0xb5,0,0,0,0,0,0,0,0,0,0}}} |
|---|
| 89 | #define I2P_PREFIX_LEN TOR_PREFIX_LEN |
|---|
| 90 | #define I2P_PREFIX4 TOR_PREFIX4 |
|---|
| 91 | #define I2P_PREFIX4_MASK TOR_PREFIX4_MASK |
|---|
| 92 | //! internal domain |
|---|
| 93 | #define I2P_DOMAIN ".oc.b32.i2p" |
|---|
| 94 | //! Total length of .onion-URL |
|---|
| 95 | #define I2P_ONION_NAME_SIZE (ONION_URL_LEN + 12) |
|---|
| 96 | //! Local listening port for incoming connections from TOR. |
|---|
| 97 | #define I2P_OCAT_LISTEN_PORT 8061 |
|---|
| 98 | //! Local control port for querying status information. |
|---|
| 99 | #define I2P_OCAT_CTRL_PORT 8067 |
|---|
| 100 | //! Virtual destination port for hidden services |
|---|
| 101 | #define I2P_OCAT_DEST_PORT I2P_OCAT_LISTEN_PORT |
|---|
| 102 | //! SOCKS port of TOR proxy |
|---|
| 103 | #define I2P_SOCKS_PORT 9051 |
|---|
| 104 | #define I2P_OCAT_CONNECT_LOG "gcat_connect_log" |
|---|
| 105 | #define I2P_PID_FILE "/var/run/gcat.pid" |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | #endif |
|---|
| 109 | |
|---|