Code Monkey home page Code Monkey logo

wireguarddb's People

Contributors

marneu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

wireguarddb's Issues

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.