/* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2007-2020, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file or_options_st.h * * \brief The or_options_t structure, which represents Tor's configuration. */ #ifndef TOR_OR_OPTIONS_ST_H #define TOR_OR_OPTIONS_ST_H #include "core/or/or.h" #include "lib/cc/torint.h" #include "lib/net/address.h" #include "app/config/tor_cmdline_mode.h" struct smartlist_t; struct config_line_t; struct config_suite_t; struct routerset_t; /** Enumeration of outbound address configuration types: * Exit-only, OR-only, PT-only, or any of them */ typedef enum { /** Outbound IP address for Exit connections. Controlled by the * `OutboundBindAddressExit` configuration entry in torrc. */ OUTBOUND_ADDR_EXIT, /** Outbound IP address for OR connections. Controlled by the * `OutboundBindAddressOR` configuration entry in torrc. */ OUTBOUND_ADDR_OR, /** Outbound IP address for PT connections. Controlled by the * `OutboundBindAddressPT` configuration entry in torrc. */ OUTBOUND_ADDR_PT, /** Outbound IP address for any outgoing connections. Controlled by the * OutboundBindAddress configuration entry in torrc. This value is used as * fallback if the more specific OUTBOUND_ADDR_EXIT, OUTBOUND_ADDR_OR, and * OUTBOUND_ADDR_PT are unset. */ OUTBOUND_ADDR_ANY, /** Max value for this enum. Must be the last element in this enum. */ OUTBOUND_ADDR_MAX } outbound_addr_t; /** Which protocol to use for TCPProxy. */ typedef enum { /** Use the HAProxy proxy protocol. */ TCP_PROXY_PROTOCOL_HAPROXY } tcp_proxy_protocol_t; /** Enumeration of available time formats for output of --key-expiration */ typedef enum { KEY_EXPIRATION_FORMAT_ISO8601 = 0, KEY_EXPIRATION_FORMAT_TIMESTAMP } key_expiration_format_t; /** Configuration options for a Tor process. */ struct or_options_t { uint32_t magic_; /** What should the tor process actually do? */ tor_cmdline_mode_t command; char *command_arg; /**< Argument for command-line option. */ struct config_line_t *Logs; /**< New-style list of configuration lines * for logs */ int LogTimeGranularity; /**< Log resolution in milliseconds. */ int LogMessageDomains; /**< Boolean: Should we log the domain(s) in which * each log message occurs? */ int TruncateLogFile; /**< Boolean: Should we truncate the log file before we start writing? */ char *SyslogIdentityTag; /**< Identity tag to add for syslog logging. */ char *DebugLogFile; /**< Where to send verbose log messages. */ char *DataDirectory_option; /**< Where to store long-term data, as * configured by the user. */ char *DataDirectory; /**< Where to store long-term data, as modified. */ int DataDirectoryGroupReadable; /**< Boolean: Is the DataDirectory g+r? */ char *KeyDirectory_option; /**< Where to store keys, as * configured by the user. */ char *KeyDirectory; /**< Where to store keys data, as modified. */ int KeyDirectoryGroupReadable; /**< Boolean: Is the KeyDirectory g+r? */ char *CacheDirectory_option; /**< Where to store cached data, as * configured by the user. */ char *CacheDirectory; /**< Where to store cached data, as modified. */ int CacheDirectoryGroupReadable; /**< Boolean: Is the CacheDirectory g+r? */ char *Nickname; /**< OR only: nickname of this onion router. */ /** OR only: configured address for this onion router. Up to two times this * options is accepted as in IPv4 and IPv6. */ struct config_line_t *Address; /** Boolean: If set, disable IPv6 address resolution, IPv6 ORPorts, IPv6 * reachability checks, and publishing an IPv6 ORPort in its descriptor. */ int AddressDisableIPv6; char *PidFile; /**< Where to store PID of Tor process. */ struct routerset_t *ExitNodes; /**< Structure containing nicknames, digests, * country codes and IP address patterns of ORs to * consider as exits. */ struct routerset_t *MiddleNodes; /**< Structure containing nicknames, * digests, country codes and IP address patterns * of ORs to consider as middles. */ struct routerset_t *EntryNodes;/**< Structure containing nicknames, digests, * country codes and IP address patterns of ORs to * consider as entry points. */ int StrictNodes; /**< Boolean: When none of our EntryNodes or ExitNodes * are up, or we need to access a node in ExcludeNodes, * do we just fail instead? */ struct routerset_t *ExcludeNodes;/**< Structure containing nicknames, * digests, country codes and IP address patterns * of ORs not to use in circuits. But see * StrictNodes above. */ struct routerset_t *ExcludeExitNodes;/**< Structure containing nicknames, * digests, country codes and IP address * patterns of ORs not to consider as * exits. */ /** Union of ExcludeNodes and ExcludeExitNodes */ struct routerset_t *ExcludeExitNodesUnion_; int DisableAllSwap; /**< Boolean: Attempt to call mlockall() on our * process for all current and future memory. */ struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */ int ExitPolicyRejectPrivate; /**< Should we not exit to reserved private * addresses, and our own published addresses? */ int ExitPolicyRejectLocalInterfaces; /**< Should we not exit to local * interface addresses? * Includes OutboundBindAddresses and * configured ports. */ int ReducedExitPolicy; /**