radio24/TorBox

define torbox.run

Closed this issue · 7 comments

Please make a description inside the file so I can discern it from the torbox.lib.
This file manages global variables -- please don't remove the file
It contains some variables that I would say that are compatible with the lib.
What I can see that is edited by the scripts is:


# Triggers some actions after a fresh installation
# 0 - Not a fresh installation - does nothing
# 1 - Delete pi after running run_install.sh (currently: 1 -> 3)
# 2 - Generate new unique SSH server keys needed after flashing the image on a SDcard (currently: 2 -> 3)
# 3 - Ask for the activating of bridges before unmasking and enabling tor
FRESH_INSTALLED=0

# SSH access from the Internet
# 0 - SSH access from the Internet is blocked HTTP (default)
# 1 - SSH access from the Internet is allowed
SSH_FROM_INTERNET=0

# Access to the Tor control port
# 0 - Tor control port is limited to localhost connections (default)
# 1 - Tor control port access from clients is allowed
TOR_CONTROL_PORT_ACCESS=0

# HTTP plain text blocking
# 0 - HTTP plain text traffic can pass through tor (default)
# 1 - HTTP plain text traffic is blocked
BLOCK_HTTP=0

# TorBox's automatic countermeasures
# 0 - TorBox's automatic countermeasures are deactivated (default)
# 1 - TorBox's automatic countermeasures are activated
LOGCHECK=0

## Global variables to help inter-script communication - don't change them!!

# Where is the Internet?
INTERNET_IFACE=eth0

# Where are the Clients? If you use multiple interfaces, separate them with a space.
CLIENT_IFACE=wlan0 eth1

# Exit controll variable
EXITID=0

It contains some variables that I would say that are compatible with the lib.

Which ones?

the rest

# DNS resolutions
# During the installation, during updates and communicating with
# torproject.org, local DNS resolutions are made by default through
# Google’s and Cloudflare’s Domain Name Servers to avoid cheap censorship
# mechanisms. However, you can add here your preferred name servers
# (separated by a comma). Data traffic from the connected
# clients, which has to be protected, is completely routed through Tor
# (including DNS requests). Additionally, TorBox is configured that any
# direct DNS requests from clients are blocked.
NAMESERVERS=1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4

# Ping URL
# Sometimes, we have to check the connectivity of the TorBox with a ping.
# Because it is only a ping, and the pinged server should be very stable, accessible
# and have a extensive traffic, we choose as default http://google.com. However,
# you can change it to whatever you like. This server will also be used when
# activating the "Countermeasure against a disconnection when idle feature" in
# the Countermeasure sub-menu.
PING_SERVER=http://google.com

# Used URLs (pre-filled with the default values)
# Used go version
GO_VERSION=go1.16.6.linux-armv6l.tar.gz
GO_VERSION_64="go1.16.6.linux-arm64.tar.gz"
GO_DL_PATH=https://golang.org/dl/
# Release Page of the unofficial Tor repositories on GitHub
TORURL=https://github.com/torproject/tor/releases
# The path to the release tags on GitHub
TORPATH_TO_RELEASE_TAGS="/torproject/tor/releases/tag/
# TORURL_DL_PARTIAL is the the partial download path of the tor release packages
# (highlighted with "-><-": ->https://github.com/torproject/tor/releases/tag/tor<- -0.4.6.6.tar.gz)
TORURL_DL_PARTIAL=https://github.com/torproject/tor/archive/refs/tags/tor
# Snowflake repositories
SNOWFLAKE_ORIGINAL=https://git.torproject.org/pluggable-transports/snowflake.git
SNOWFLAKE_USED=https://github.com/keroserene/snowflake.git
# Vanguards Repository
VANGUARDS_USED=https://github.com/mikeperry-tor/vanguards
VANGUARDS_COMMIT_HASH=10942de
VANGUARD_LOG_FILE="/var/log/tor/vanguards.log
# TorBox Repository
TORBOXURL=https://github.com/radio24/TorBox/
TORBOX_USED=https://github.com/radio24/TorBox/archive/refs/heads/master.zip
TORBOXMENU_BRANCHNAME=master
# Wiringpi
WIRINGPI_USED=https://project-downloads.drogon.net/wiringpi-latest.deb
# WiFi drivers from Fars Robotics
FARS_ROBOTICS_DRIVERS=http://downloads.fars-robotics.net/wifi-drivers/

For example, where do you see NAMESERVERS=1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4 in the lib?

I had all functions in torbox.lib and all global variables in torbox.run from the start. This is because I don't want that scripts and users are editing torbox.lib.

Not that is it there, but it is compatible with the lib because it can be sourced.
There are variables on lib and run, but on run, the variables can be modified, just that.

I am just proposing to separate the variables that can be modified to be left on run and the rest move to lib.
Variables that are edited by the scripts are left on run: such as EXITID.

Sorry, but I don't want to have global variables in lib. For me, lib is reserved for functions.
I probably have to add that this is a habit I bring from my experiences with Pascal, Perl and so on....