An AddOn storing wireguard configuration

Overview

Wireguard Database Connector Overview

Development Status: 0.1.7 (alpha)

First of all, I'd like to thank Jared McKnight for wireguard who inspired me to make this AddOn.

The Wireguard Database Connector makes use of the ORM peewee, providing a broader approach to several database systems.

DB Field & Function policy: Only compatible fields/functions are used to support migrations from one to the other.

Database backends tested for far:

  • sqlite3
  • mariadb
  • postgres
  • Please report here more if successful tested and/or commit your code

In most cases the use of cython is recommended.

For more known python modules consult the peewee documentation: https://docs.peewee-orm.com/en/latest/peewee/database.html

Quick Start using Database

First run on python3 (=>3.6)

One the first create a default configfile at /etc/wireguard/wireguard.yaml

from wireguardDB.models.config import DBConfig
# now enshure you can write and read the config.yaml
# it will create a /etc/wireguard/wireguard.yaml file
if DBConfig().write():
    setup = DBConfig().read()
setup
# you should see a tuple containing the default setup for a sqlite3 connector
exit()

This should have created a sample configfile, now edit this to your needs. Errors may indicate that you are either not authorized to use or create files in /etc/wireguard or the directory itself does not exist. If you are using only one database type (adapter) you do not need to remove any other of the sections for other adpters.

The default /etc/wireguard/wireguard.yaml should be self explaining for those used in working with databases on a system level.

Test a connection to your database

from wireguardDB.models import DBConfig, DBConnect
# try a connection
# in short
db = DBConnect().set(DBConfig.read())
# is
setup = DBConfig.read()
db = DBConnect().set(setup)

Further reading

You might also like...
Addon for Blender 2.8+ that automatically creates NLA tracks for all animations. Useful for GLTF export.
Addon for Blender 2.8+ that automatically creates NLA tracks for all animations. Useful for GLTF export.

PushDownAll An addon for Blender 2.8+ that runs Push Down on all animations, creating NLA tracks for each. This is useful if you have an object with m

Blender addon - Breakdown in object mode

Breakdowner Breakdown in object mode Download latest Demo Youtube Description Same breakdown shortcut as in armature mode in object mode Currently onl

A Blender addon to align the origin to the top, center or bottom of a mesh object
A Blender addon to align the origin to the top, center or bottom of a mesh object

Align Origin Blender Addon. Align Origin Blender Addon. What? This simple addon lets you align the origin to the top, center or bottom of a mesh objec

Blender addon that simplifies access to useful operators and adds missing functionality
Blender addon that simplifies access to useful operators and adds missing functionality

Quick Menu is a Blender addon that simplifies common tasks Compatible with Blender 3.x.x Install through Edit - Preferences - Addons - Install... -

Blender Addon for Snapping a UV to a specific part of a Tilemap

UVGridSnapper A simple Blender Addon for easier texturing. A menu in the UV editor allows a square UV to be snapped to an Atlas texture, or Tilemap. P

Blender addon for executing the operator in response to the received OSC message.
Blender addon for executing the operator in response to the received OSC message.

I/F Joiner 受信したOSCメッセージに応じてオペレータ(bpy.ops)を実行するアドオンです. OSC通信に対応したコントローラやアプリをインストールしたスマートフォンを使用してBlenderを操作することが可能になります. 同時開発しているAndroidコントローラ化アプリMocopa

Easytile blender - Simple Blender 2.83 addon for tiling meshes easily

easytile_blender Dead simple, barebones Blender (2.83) addon for placing meshes as tiles. Installation In Blender, go to Edit Preferences Add-ons

A Blender addon for VSE that auto-adjusts video strip's length, if speed effect is applied.

Blender VSE Speed Adjust Addon When using Video Sequence Editor in Blender, the speed effect strip doesn't auto-adjusts clip length when changing its

Blender addon, import and update mixamo animation

This is a blender addon for import and update mixamo animations.

Comments
  • Cant connect to MySQL DB

    Cant connect to MySQL DB

    Again its me :)

    try to connect on Mysql DB next code:

    from wireguard_db.models import DBConfig, DBConnect, WGData, WGRelation
      
    setup = DBConfig().read(config_adapter='mysql')
    db_mysql = DBConnect(setup).get()
    
    

    and my output next:

    _> root@node1:/project/wg/wireguardDB# python3 crdb.py

    Traceback (most recent call last): File "crdb.py", line 4, in db_mysql = DBConnect(setup).get() File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 33, in init self.set(setup) File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 81, in set self.check() File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 124, in check dbtable.create_table(safe=True) File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 6717, in create_table and cls.table_exists(): File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 6707, in table_exists return cls._schema.database.table_exists(M.table.name, M.schema) File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3326, in table_exists return table_name in self.get_tables(schema=schema) File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 4042, in get_tables return [table for table, in self.execute_sql(query, ('VIEW',))] File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3158, in execute_sql cursor = self.cursor(commit) File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3142, in cursor self.connect() File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3096, in connect self._state.set_connection(self._connect()) File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 4013, in _connect conn = mysql.connect(db=self.database, **self.connect_params) File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 353, in init self.connect() File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 633, in connect self._request_authentication() File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 869, in _request_authentication authresp = _auth.scramble_caching_sha2(self.password, self.salt) File "/usr/local/lib/python3.8/dist-packages/pymysql/_auth.py", line 198, in scramble_caching_sha2 p1 = hashlib.sha256(password).digest() TypeError: object supporting the buffer API required _

    i think my problem in this(i.e. i have DB but show tables; Empty)

    File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 33, in init self.set(setup)

      def __init__(self, setup: tuple = None):
            """
            Initialize a database connector on given setup
            :param config: dict: Optional, the setup from DBConfig.get(), can be setup later
            ivar _adapter: str: adapter name
            ivar _database: obj: peewee.DatabaseProxy
            ivar _connected: bool: connected state of db
            """
            self._adapter = None
            self._database = None
            self._connected = False
    
            if setup:
                # full init if setup is given
                **self.set(setup)**
    
    

    FYI little problem YAML file generate with error username instead wguser wgdb

    opened by AndreyMariyko 2
  • install module

    install module

    Hello Marcus I did steps:

    python3 -m pip install cython python3 -m pip install PyMySQL python3 -m pip install peewee

    and create db.py file with your code:

    and coy code from this 
    from wireguard_db.models.config import DBConfig
    # now enshure you can write and read the config.yaml
    # it will create a /etc/wireguard/wireguard.yaml file
    if DBConfig().write():
        setup = DBConfig().read()
    setup
    # you should see a tuple containing the default setup for a sqlite3 connector
    exit()
    
    

    when I run the script I see next

    Traceback (most recent call last): File "db.py", line 1, in from wireguard_db.models.config import DBConfig ModuleNotFoundError: No module named 'wireguard_db'

    i'll try install module from pip but this failed. also i cand fount setup.py in your repo

    pip python -m pip install wireguard_db ERROR: Could not find a version that satisfies the requirement wireguard_db (from versions: none) ERROR: No matching distribution found for wireguard_db

    could you help me install your module. I want to create DB (25k clients) and use module wireguard. https://github.com/fictivekin/wireguard

    opened by AndreyMariyko 1
Owner
Markus Neubauer
Markus Neubauer
Python-geoarrow - Storing geometry data in Apache Arrow format

geoarrow Storing geometry data in Apache Arrow format Installation $ pip install

Joris Van den Bossche 11 Mar 3, 2022
kodi addon 115网盘

plugin.video.115 kodi addon 115网盘 插件,需要kodi 18以上版本,原码播放需配合 https://github.com/feelfar/115proxy-for-kodi 使用 安装 <<<<<<< HEAD 由于release包尚未释出,可直接下载源代码zip包

null 109 Dec 29, 2022
addon for blender to import mocap data from tools like easymocap, frankmocap and Vibe

b3d_mocap_import addon for blender to import mocap data from tools like easymocap, frankmocap and Vibe ==================VIBE================== To use

Carlos Barreto 97 Dec 7, 2022
A small Blender addon for changing an object's local orientation while in edit mode

A small Blender addon for changing an object's local orientation while in edit mode.

Jonathan Lampel 50 Jan 6, 2023
Anki Addon idea by gbrl.sc to see previous ratings of a card in the reviewer

Card History At A Glance Stop having to press card browser and ctrl+i for every card and then WINCING to see it's history of reviews FEATURES Visualiz

Jerry Zhou 11 Dec 19, 2022
tgEasy | Easy for a Brighter Shine | Monkey Patcher Addon for Pyrogram

tgEasy | Easy for a Brighter Shine | Monkey Patcher Addon for Pyrogram

Jayant Hegde Kageri 35 Nov 12, 2022
Addon to give a keybind to automatically enable contact shadows on all lights in a scene

3-2-1 Contact(Shadow) An easy way to let you enable contact shadows on all your lights, because Blender doesn't enable it by default, and doesn't give

TDV Alinsa 3 Feb 2, 2022
Purge all transformation orientations addon for Blender 2.8 and newer versions

CTO Purge This add-on adds a new button to Blender's Transformation Orientation panel which empowers the user to purge all of his/her custom transform

MMMrqs 10 Dec 29, 2022
Blender addon to import images as meshes

ImagesAsMesh Blender addon to import images as meshes. Inspired by: ImagesAsPlanes Installation It's like just about every other Blender addon. Downlo

Niccolo Zuppichini 4 Jan 4, 2022
Blender addon that enables exporting of xmodels from blender. Great for custom asset creation for cod games

Birdman's XModel Tools For Blender Greetings everyone in the custom cod community. This blender addon should finally enable exporting of custom assets

wast 2 Jul 2, 2022