eduvpn_common package
Submodules
eduvpn_common.discovery module
eduvpn_common.error module
eduvpn_common.event module
- class eduvpn_common.event.EventHandler
Bases:
object
The class that neatly handles event callbacks
- add_event(state: State, state_type: StateType, func: Callable) None
Adds an event :param state: State: The state to add the event for :param state_type: StateType: The state type to add the event for :param func: Callable: The function that needs to be added to the event :meta private:
- change_class_callbacks(cls: Any, add: bool = True) None
The function that is used to change class callbacks :param cls: Any: The class to change the callbacks for :param add: bool: (Default value = True): Whether or not to add or remove the event. If true the event gets added :meta private:
- remove_event(state: State, state_type: StateType, func: Callable) None
Removes an event :param state: State: The state to remove the event for :param state_type: StateType: The state type to remove the event for :param func: Callable: The function that needs to be removed from the event :meta private:
- run(old_state: State, new_state: State, data: Any) bool
Run a specific event. It converts the data and then runs the event for all state types :param old_state: State: The previous state for running the event :param new_state: State: The new state for running the event :param data: Any: The data that gets passed to the event :param convert: bool: (Default value = True): Whether or not to convert the data further
- run_state(state: State, other_state: State, state_type: StateType, data: str) bool
The function that runs the callback for a specific event :param state: State: The state of the event :param other_state: State: The other state of the event :param state_type: StateType: The state type of the event :param data: str: The data that gets passed to the function callback when the event is ran :meta private:
eduvpn_common.loader module
eduvpn_common.main module
- class eduvpn_common.main.EduVPN(name: str, version: str, config_directory: str)
Bases:
object
The main class used to communicate with the Go library. It registers the client with the library and then calls the needed appropriate functions
- Parameters:
name – str: The name of the client. For commonly used names, see https://git.sr.ht/~fkooman/vpn-user-portal/tree/v3/item/src/OAuth/ClientDb.php. E.g. org.eduvpn.app.linux, if this name has “letsconnect” in it, then it is a Let’s Connect! variant
version – str: The version number of the client as a string
config_directory – str: The directory (absolute/relative) where to store the files
- add_server(_type: ServerType, _id: str, ot: int | None = None) None
Add a server
- Parameters:
_type – ServerType: The type of server e.g. SERVER.INSTITUTE_ACCESS
_id – str: The identifier of the server, e.g. “https://vpn.example.com/”
ot – Optional[int]: The time when OAuth was last started.
if != None the server is added without any interactivity
- Raises:
WrappedError – An error by the Go library
- cancel()
- cleanup() None
Cleanup the vpn connection
- Parameters:
tokens – str (Default value = “”): The OAuth tokens if available
- Raises:
WrappedError – An error by the Go library
- cookie_reply(cookie: int, data: str) None
Reply with the given cookie and data
- deregister() None
Deregister the Go shared library. This removes the object from internal bookkeeping and saves the configuration
- deregister_class_callbacks(_class)
- get_current_server() str
- get_disco_organizations() str
- get_disco_servers() str
- get_expiry_times() str
- get_servers() str
- go_cookie_function(func: Any, *args: Iterator) Any
- register(debug: bool = False) None
Register the Go shared library. This makes sure the FSM is initialized and that we can call Go functions
- Parameters:
debug – bool: (Default value = False): Whether or not we want to enable debug logging
- register_class_callbacks(_class)
- remove_server(_type: ServerType, _id: str) None
Remove a server
- Parameters:
_type – ServerType: The type of server e.g. SERVER.INSTITUTE_ACCESS
_id – str: The identifier of the server, e.g. “https://vpn.example.com/”
- Raises:
WrappedError – An error by the Go library
- renew_session() None
Renew the session. This invalidates the tokens and runs the necessary callbacks to log back in
- Raises:
WrappedError – An error by the Go library
- set_profile(profile_id: str) None
Set the profile of the current server
- Parameters:
profile_id – str: The profile id of the chosen profile for the server
- Raises:
WrappedError – An error by the Go library
- set_secure_location(org_id: str, country_code: str) None
Set the secure location
- Parameters:
org_id – str: The organisation ID
country_code – str: The country code of the new location
- Raises:
WrappedError – An error by the Go library
- set_token_handler(getter: Callable, setter: Callable) None
- start_failover(gateway: str, wg_mtu: int, readrxbytes: ~ctypes.CFUNCTYPE.<locals>.CFunctionType) bool
- start_proxyguard(listen: str, source_port: int, peer: str, setup: ~ctypes.CFUNCTYPE.<locals>.CFunctionType, ready: ~ctypes.CFUNCTYPE.<locals>.CFunctionType)
- class eduvpn_common.main.Jar(canceller)
Bases:
object
A cookie jar
- add(cookie)
- cancel()
- delete(cookie)
- class eduvpn_common.main.ServerType(value)
Bases:
IntEnum
An enumeration.
- CUSTOM = 3
- INSTITUTE_ACCESS = 1
- SECURE_INTERNET = 2
- UNKNOWN = 0
- exception eduvpn_common.main.WrappedError(translations, language, misc)
Bases:
Exception
- eduvpn_common.main.forwardError(error: str)
eduvpn_common.server module
eduvpn_common.state module
eduvpn_common.types module
- eduvpn_common.types.conv_longlongp(val: int | None) LP_c_long