myDC.ru

Здравствуйте, гость ( Вход | Регистрация )

 
  Защитный вопрос
Для публикации сообщения необходимо ответить на следующий вопрос:
2 в 3 степени плюс 3 (2^3+3)?

Ответ в µHub для LEDE|OPENWRT (Легкий хаб с шифрованием)
Name
Введите ваше имя
Сообщение
 

Опции сообщения
 Включить смайлы?
Иконки сообщения
(Опционально)
                                
                                
  [ Без иконки ]
 


Последние 10 сообщений [ в обратном порядке ]
мамин_парень Дата 3.2.2019, 11:17
  uHUB для LEDE|OPENWRT



uhub_0.5.0-4_mips_24kc.ipk для TP-LINK Atheros AR9331 Или с нашего форума: Прикрепленный файл  uhub_050_openwrtr.zip ( 2.02 мегабайт ) Кол-во скачиваний: 41


Файлы настроек и файл автозапуска

µHub (micro-Hub) — ADC хаб написанный на C под лицензией GPLv3. Работает в операционных системах Linux, Windows, BSD и других. Имеет только базовую функциональность для p2p. Крайне нетребователен к ресурсам — при 350 пользователях занимает в памяти несколько десятков килобайт ОЗУ. Возможна работа на устройствах поддерживающих ПО OpenWRT.

Advanced Direct Connect (ADC) — протокол для файлообменных сетей, основанный на протоколе Direct Connect (DC). ADC-клиенты подключаются к центральному серверу и обмениваются файлами напрямую между участниками сети.

Начиная с версии 3.2 поддерживает шифрование server-client, так называемую ADCS-mode. Начиная с версии 4.0 будет введена система плагинов с простым API. Тестовый хаб автора: adcs://adc.extatic.org:1511



Что нового в версии 0.5.0:

Use TLS 1.2 and strong ciphers by default, but made this configurable.
Fix TLS event handling which caused some busy loops
TLS: Support certificate chains
Fix bug #211: Better Hublist pinger support by adding the AP flag of the INF message.
Fix bug #198: Timers could cause infinite loops
Sqlite3 is now mandatory
Added mod_chat_history_sqlite and mod_chat_is_privileged.
Support for systemd notify and journal logging
Improved flood control counting to strictly not allow more than the given amount of messages in the configured interval.
Optimize lookups by CID and nick.
Added an NMDC and ADC hub redirectors written in Python.
Fix all Clang compile warnings.
Install uhub-passwd also.
Add support for detecting HTTP connections to the hub. Enough to tell browsers to stop calling.
Compile fixes for OpenBSD, including warnings about strcat.
Fix crashing autotest due to wrong initialization of the usermanager.
mod_topic: check argument for NULL
rename !cleartopic to !resettopic



Исходник:

Makefile
Код
#
# Copyright (C) 2009-2019 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=uhub
PKG_VERSION:=0.5.0
PKG_RELEASE:=4

PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.gz
PKG_SOURCE_URL:=https://github.com/janvidar/uhub
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=90d05c9a19d3f72e3bdc89e4906c9e254e6a7f10
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/uhub
  SUBMENU:=P2P
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+libevent +libopenssl +libsqlite3
  TITLE:=High performance ADC hub
  URL:=http://www.uhub.org
endef

define Package/uhub/description
    uhub is a high performance peer-to-peer hub for the ADC network.
        Its low memory footprint allows it to handle several thousand users
        on high-end servers, or a small private hub on embedded hardware.
endef
define Build/Configure
    $(call Build/Configure/Default)
endef

CMAKE_OPTIONS =

define Package/uhub/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/uhub $(1)/usr/bin/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhub-admin $(1)/usr/bin/
    $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/uhub-passwd $(1)/usr/bin/
    $(INSTALL_DIR) $(1)/etc/uhub/
    $(INSTALL_DIR) $(1)/usr/lib/uhub/
    $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/uhub/mod_welcome.so $(1)/usr/lib/uhub/
    $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/uhub/mod_logging.so $(1)/usr/lib/uhub/
    $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/uhub/mod_chat_history.so $(1)/usr/lib/uhub/
    $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/uhub/mod_topic.so $(1)/usr/lib/uhub/
    $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/uhub/mod_auth_simple.so $(1)/usr/lib/uhub/
    $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/uhub/uhub.conf $(1)/etc/uhub/
    $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/uhub/plugins.conf $(1)/etc/uhub/
    $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/uhub/rules.txt $(1)/etc/uhub/
endef

define Package/uhub/conffiles
/etc/uhub/uhub.conf
/etc/uhub/plugins.conf
endef

$(eval $(call BuildPackage,uhub))




Первый запуск хаба

Если вот такая ошибка:




root@LEDE:~# uhub
Цитата
2019-01-30 12:38:17 ERROR: Unable to open file /etc/uhub/users.conf: No such file or directory
2019-01-30 12:38:17 INFO: Starting uhub/0.5.0, listening on :::1511...
2019-01-30 12:38:17 ERROR: Unable to open plugin /usr/lib/uhub/mod_auth_sqlite.so: Error loading shared library /usr/lib/uhub/mod_auth_sqlite.so: No such file or directory
Segmentation fault


Я пока не разбирался как создать этот плагин посредством хаба, просто тупо выключил его в файле /etc/uhub/plugins.conf

# plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"

Мой файл uhub.conf
Код
# uhub.conf - A example configuration file.
# You should normally place this file in /etc/uhub/uhub.conf
# and customize some of the settings below.
#
# This file is read only to the uhub deamon, and if you
# make changes to it while uhub is running you can send a
# HUP signal to it ( $ killall -HUP uhub ), to reparse configuration (only on UNIX).
# All configuration directives: http://www.uhub.org/config.php

# Bind to this port and address
# server_bind_addr=any means listen to "::" if IPv6 is supported
# by the host OS, otherwise 0.0.0.0.
server_port=411
server_bind_addr=any

# Alternative server ports
# server_alt_ports = 1512, 1513

# The maximum amount of users allowed on the hub.
max_users=500

# If 1, will show a "Powered by uHub/{VERSION}".
show_banner=1

# If enabled then operating system and cpu architecture is part of the banner.
show_banner_sys_info=1

# Allow only registered users on the hub if set to 1.
registered_users_only=0

# A server name and description.
hub_name=DCBEELINEKZ
hub_description=DCBEELINEKZ http://dcbeelinekz.do.am

# Set this to 0, and the hub will disconnect everyone
hub_enabled=1

# Access control list (user database)
file_acl=/etc/uhub/users.conf

# This file can contain a conf for plugin subsystem
file_plugins = /etc/uhub/plugins.conf

# Slots/share/hubs limits
limit_max_hubs_user = 0
limit_max_hubs_reg = 0
limit_max_hubs_op = 0
limit_max_hubs = 0
limit_min_hubs_user = 0
limit_min_hubs_reg = 0
limit_min_hubs_op = 0
limit_min_share = 0
#    Example:
#    To require users to share at least 1 GB in order to enter the hub:
#    limit_min_share = 1024
limit_max_share = 0
limit_min_slots = 0
limit_max_slots = 0

# Flood control support:
# set the interval to 5 seconds
flood_ctl_interval = 5

# Then the maximum chat, connect, search, updates etc will be measured over 5 seconds.
# So, 3 chat messages per 5 seconds allowed.
flood_ctl_chat=3
flood_ctl_connect=20
flood_ctl_search=1
flood_ctl_update=2
flood_ctl_extras=5

# chat control
# if chat_is_privileged=yes only registered users may write in main chat
chat_is_privileged = no


# if obsolete_clients=1 allows old clients to enter , 0 gives an error message (msg_proto_obsolete_adc0) if they try connect
# defaults obsolete_clients=1
obsolete_clients=1


# Configure status message as sent to clients in different circumstances.
msg_hub_full                   = Hub is full
msg_hub_disabled               = Hub is disabled
msg_hub_registered_users_only  = Hub is for registered users only
msg_inf_error_nick_missing     = No nickname given
msg_inf_error_nick_multiple    = Multiple nicknames given
msg_inf_error_nick_invalid     = Nickname is invalid
msg_inf_error_nick_long        = Nickname too long
msg_inf_error_nick_short       = Nickname too short
msg_inf_error_nick_spaces      = Nickname cannot start with spaces
msg_inf_error_nick_bad_chars   = Nickname contains invalid characters
msg_inf_error_nick_not_utf8    = Nickname is not valid utf8
msg_inf_error_nick_taken       = Nickname is already in use
msg_inf_error_nick_restricted  = Nickname cannot be used on this hub
msg_inf_error_cid_invalid      = CID is not valid
msg_inf_error_cid_missing      = CID is not specified
msg_inf_error_cid_taken        = CID is taken
msg_inf_error_pid_missing      = PID is not specified
msg_inf_error_pid_invalid      = PID is invalid
msg_ban_permanently            = Banned permanently
msg_ban_temporarily            = Banned temporarily
msg_auth_invalid_password      = Password is wrong
msg_auth_user_not_found        = User not found in password database
msg_user_share_size_low           = User is not sharing enough
msg_user_share_size_high       = User is sharing too much
msg_user_slots_low           = User has too few upload slots
msg_user_slots_high           = User has too many upload slots
msg_user_hub_limit_low            = User is on too few hubs
msg_user_hub_limit_high           = User is on too many hubs
msg_error_no_memory            = Out of memory
msg_user_flood_chat            = НЕ ПИЗДИ МНОГО.
msg_user_flood_connect         = Connect flood detected, connection refused.
msg_user_flood_search          = Search flood detected, search is stopped.
msg_user_flood_update          = Update flood detected.
msg_user_flood_extras          = Flood detected.

# If a client that supports ADC but not a compatible hash algorithm (tiger),
# then the hub cannot accept the client:
msg_proto_no_common_hash       = No common hash algorithm.

# Message to be shown to old clients using an older version of ADC than ADC/1.0
msg_proto_obsolete_adc0        = Client is using an obsolete ADC protocol version.


Файл plugins.conf
Код
# ATTENTION!
# Plugins are invoked in the order of listing in the plugin config file.


# Sqlite based user authentication.
#
# This plugin provides a Sqlite based authentication database for
# registered users.
# Use the uhub-passwd utility to create the database and add/remove users.
#
# Parameters:
# file: path/filename for database.
#
#plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"

# Topic commands.
# Note: "topic" == "hub description" (as configured in uhub.conf)
#
# !topic      - change the topic (op required)
# !showtopic  - show the topic
# !resettopic - reset the topic to the default (op required)
#
# This plugins takes no parameters.
plugin /usr/lib/uhub/mod_topic.so

# Log file writer
#
# Parameters:
# file: path/filename for log file.
# syslog: if true then syslog is used instead of writing to a file (Unix only)
plugin /usr/lib/uhub/mod_logging.so "file=/var/log/uhub.log"

# A simple example plugin
#plugin /usr/lib/uhub/mod_example.so

# A plugin sending a welcome message.
#
# This plugin provides the following commands:
# !motd - Message of the day
# !rules - Show hub rules.
#
# Parameters:
# motd: path/filename for the welcome message (message of the day)
# rules: path/filenam for the rules file
#
# NOTE: The files MUST exist, however if you do not wish to provide one then these parameters can be omitted.
#
# The motd/rules files can do the following substitutions:
# %n - Nickname of the user who entered the hub or issued the command.
# %a - IP address of the user
# %c - The credentials of the user (guest, user, op, super, admin).
# %% - Becomes '%'
# %H - Hour 24-hour format (00-23) (Hub local time)
# %I - Hour 12-hour format (01-12) (Hub local time)
# %P - 'AM' or 'PM'
# %p - 'am' or 'pm'
# %M - Minutes (00-59) (Hub local time)
# %S - Seconds (00-60) (Hub local time)
plugin /usr/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt"

# Load the chat history plugin.
#
# This plugin provides chat history when users are connecting, or
# when users invoke the !history command.
# The history command can optionally take a parameter to indicate how many lines of history is requested.
#
# Parameters:
# history_max:     the maximum number of messages to keep in history
# history_default: when !history is provided without arguments, then this default number of messages are returned.
# history_connect: the number of chat history messages to send when users connect (0 = do not send any history)
plugin /usr/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5"


Как выглядит файл автозапуска:

etc/init.d/uhub

Код
#!/bin/sh /etc/rc.common
# uhub launcher

START=50
STOP=10
USE_PROCD=1
UHUB=/usr/bin/uhub

start_service() {
  procd_open_instance
  procd_set_param command $UHUB -l /var/log/uhub.log -vvv
  procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
  procd_set_param file /etc/uhub/uhub.conf
  procd_set_param stdout 1
  procd_close_instance

}

stop() {
    killall $UHUB
}


!!!После создания файла надо дать права 0755



Теперь он появился в Startup в вэб-морде Luci




Конектимся к хабу и видим эту быструю красавицу, еще и шифрование можно настроить клиент-хаб )))






Логи пишутся сюда /var/log/uhub.log

Код
2019-02-03 03:34:57   INFO: Starting uhub/0.5.0, listening on :::411...
2019-02-03 03:34:57   INFO: Loaded plugin: /usr/lib/uhub/mod_topic.so: Topic plugin, version 1.0.
2019-02-03 03:34:57   INFO: Loaded plugin: /usr/lib/uhub/mod_logging.so: Logging plugin, version 1.0.
2019-02-03 03:34:57   INFO: Loaded plugin: /usr/lib/uhub/mod_welcome.so: Welcome plugin, version 0.1.
2019-02-03 03:34:57   INFO: Loaded plugin: /usr/lib/uhub/mod_chat_history.so: Chat history plugin, version 1.0.
2019-02-03 03:35:01 LoginOK     AAAB/ZC2PJJGGN2N4SUFE7IDF4UMLC4VBJGU4ZQHHVEI 192.168.1.216 "DCBEELINEKZ" (guest) "++ 0.699"

Плагины находятся тут /usr/lib/uhub/

Вот документация для следующих официальных плагинов:

mod_auth_simple - Аутентифицировать пользователей по простому текстовому файлу.
mod_auth_sqlite - Аутентификация пользователей по базе данных SQLite. - Не ставиться и не нужен этот плагин, когда есть текстовый
mod_chat_history - Предоставляет историю чата при входе в систему и запросе
mod_chat_history_sqlite - Обеспечивает постоянную историю чата при входе в систему и запросе - Не ставиться
mod_example - Пример кода плагина
mod_logging - Пишет логи.
mod_topic - Предоставляет команду !topic для изменения темы-хаба.
mod_welcome - Предоставляет простое сообщение дня и правила.

Подробно тут: https://www.uhub.org/doc/plugins/

Тема на моем форуме:
http://dcbeelinekz.1bb.ru/viewtopic.php?id=113#p319

Протестил на супер свежой OpenWRT 18.06.2
Хаб просто сказка для роутера, ОЗУ нюхает, а не ест . 300 пользователей вытащит легко + если выключить поиск ,то и того больше ))
Просмотр темы полностью (откроется в новом окне)
RSS Сейчас: 21.2.2019, 7:44