All Projects → hgoldfish → Qtnetworkng

hgoldfish / Qtnetworkng

Licence: lgpl-3.0
QtNetwork Next Generation. A coroutine based network framework for Qt/C++, with more simpler API than boost::asio.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Qtnetworkng

Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+2584%)
Mutual labels:  network, http-client, http-server, openssl, kcp
foxy
Session-based Beast/Asio wrapper requiring C++14
Stars: ✭ 61 (-51.2%)
Mutual labels:  http-client, http-proxy, asio, http-server
Foxy
Session-based Beast/Asio wrapper requiring C++14
Stars: ✭ 57 (-54.4%)
Mutual labels:  http-client, http-proxy, asio, http-server
Sylar
C++高性能分布式服务器框架,webserver,websocket server,自定义tcp_server(包含日志模块,配置模块,线程模块,协程模块,协程调度模块,io协程调度模块,hook模块,socket模块,bytearray序列化,http模块,TcpServer模块,Websocket模块,Https模块等, Smtp邮件模块, MySQL, SQLite3, ORM,Redis,Zookeeper)
Stars: ✭ 895 (+616%)
Mutual labels:  coroutine, network, http-client, http-server
Skillbox Chat
Skillbox demo application for the Python course
Stars: ✭ 86 (-31.2%)
Mutual labels:  network, tcp, qt
Mgx
🌈 A high performance network framework written in c++ (support tcp and http)
Stars: ✭ 15 (-88%)
Mutual labels:  tcp, http-server, coroutine
Firefly
Firefly is an asynchronous web framework for rapid development of high-performance web application.
Stars: ✭ 277 (+121.6%)
Mutual labels:  tcp, http-client, http-server
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-88%)
Mutual labels:  http-client, http-proxy, http-server
Yasio
A multi-platform support c++11 library with focus on asio (asynchronous socket I/O) for any client application.
Stars: ✭ 483 (+286.4%)
Mutual labels:  tcp, asio, kcp
Proxy admin free
Proxy是高性能全功能的http代理、https代理、socks5代理、内网穿透、内网穿透p2p、内网穿透代理、内网穿透反向代理、内网穿透服务器、Websocket代理、TCP代理、UDP代理、DNS代理、DNS加密代理,代理API认证,全能跨平台代理服务器。
Stars: ✭ 487 (+289.6%)
Mutual labels:  tcp, http-proxy, http-server
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+2492.8%)
Mutual labels:  http-client, asio, http-server
Cxxhttp
Asynchronous, Header-only C++ HTTP-over-(TCP|UNIX Socket|STDIO) Library
Stars: ✭ 24 (-80.8%)
Mutual labels:  http-client, asio, http-server
Goproxy
🔥 Proxy is a high performance HTTP(S) proxies, SOCKS5 proxies,WEBSOCKET, TCP, UDP proxy server implemented by golang. Now, it supports chain-style proxies,nat forwarding in different lan,TCP/UDP port forwarding, SSH forwarding.Proxy是golang实现的高性能http,https,websocket,tcp,socks5代理服务器,支持内网穿透,链式代理,通讯加密,智能HTTP,SOCKS5代理,黑白名单,限速,限流量,限连接数,跨平台,KCP支持,认证API。
Stars: ✭ 11,334 (+8967.2%)
Mutual labels:  tcp, http-proxy, socks5
Hgw
hgw是由gateway网关服务、manager控制服务构成的一套轻量级网关系统。目前支持http/https协议的服务控制
Stars: ✭ 81 (-35.2%)
Mutual labels:  http-proxy, http-server
I2p.i2p
I2P is an anonymizing network, offering a simple layer that identity-sensitive applications can use to securely communicate. All data is wrapped with several layers of encryption, and the network is both distributed and dynamic, with no trusted parties.
Stars: ✭ 1,186 (+848.8%)
Mutual labels:  network, crypto
Pangolin
轻量级内网穿透工具, 基于Java8,netty4.x实现,开箱即用,可转发基于TCP的应用层数据流,例如HTTP/HTTPS,SSH
Stars: ✭ 84 (-32.8%)
Mutual labels:  tcp, http-proxy
T Io
解决其它网络框架没有解决的用户痛点,让天下没有难开发的网络程序
Stars: ✭ 1,331 (+964.8%)
Mutual labels:  tcp, http-server
Zio Tls Http
100% non-blocking, Java NIO only( inspired by zio-nio) , JSON HTTP server based on Scala ZIO library. Everything including TLS encryption modeled as ZIO effects, convenient route DSL similar to https4s, up to 30K TPS local JSON transaction with 25 threads on 6 cores(i7) with ZIO fibers.
Stars: ✭ 71 (-43.2%)
Mutual labels:  http-client, http-server
Proxy.py
⚡⚡⚡Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging
Stars: ✭ 1,291 (+932.8%)
Mutual labels:  http-proxy, http-server
Flynet
A powerful TCP/UDP tool, which support socks5 proxy by tcp and udp, http proxy and NAT traversal. This tool can help you bypass gfw easily
Stars: ✭ 124 (-0.8%)
Mutual labels:  http-proxy, socks5

QtNetworkNg

Introduction

QtNetworkgNg is a coroutine-based network toolkit. Compare to boost::asio and Qt's QtNetwork, QtNetworkNg has more simpler API which is similar to python-gevent. As the name suggests, QtNetworkNg requires Qt5 framework. For more detail visit:

Introduction to QtNetworkNg

Documents

Visit https://qtng.org/

Features

  • General Coroutine with similar API to QThread.
  • Socket supports UDP and TCP.
  • SSLSocket with similar API to Socket.
  • KcpSocket implements KCP over UDP.
  • HttpSession implements a HTTP 1.0/1.1 client, supports connection via SOCKS5/HTTP proxy.
  • HttpServr implements a static HTTP 1.0/1.1 server, can be used for reversed http proxy.
  • MsgPackStream is a new MessagePack implementation similar to QDataStream
  • Cipher, MessageDigest, PublicKey, PrivateKey wrap complicate LibreSSL C API.

Examples

Here comes a simple example to get web pages.

#include "qtnetworkng.h"

int main(int argc, char **argv)
{
    qtng::HttpSession session;
    qtng::HttpResponse r = session.get("http://example.com/");
    qDebug() << r.html();
    return 0;
}

And another exmaple to make IPv4 tcp connection.

#include "qtnetworkng.h"

int main(int argc, char **argv)
{
    qtng::Socket conn;
    conn.connect("example.com", 80);
    conn.sendall("GET / HTTP/1.0\r\n\r\n");
    qDebug() << conn.recv(1024 * 8);
    return 0;
}

To create IPv4 tcp server.

Socket s;
CoroutineGroup workers;
s.bind(QHostAddress::Any, 8000);
s.listen(100);
while (true) {
    QSharedPointer<Socket> request(s.accept());
    if (request.isNull()) {
        break;
    }
    workers.spawn([request] {
        request->sendall("hello!");
        request->close();
    });
}

To create HTTP server is even more simpler:

TcpServer<SimpleHttpRequestHandler> httpd(QHostAddress::LocalHost, 8000);
httpd.serveForever();

A Qt GUI example to fetch web page.

// main.cpp
#include <QApplication>
#include <QTextBrowser>
#include "qtnetworkng.h"

using namespace qtng;

class HtmlWindow: public QTextBrowser
{
public:
    HtmlWindow();
    virtual ~HtmlWindow() override;
private:
    CoroutineGroup *operations;
};

HtmlWindow::HtmlWindow()
    :operations(new CoroutineGroup)
{
    operations->spawn([this] {
        Coroutine::sleep(1);
        HttpSession session;
        HttpResponse response = session.get("http://www.example.com/");
        if(response.isOk()) {
            setHtml(response.html());
        } else {
            setHtml("failed");
        }
    });
}

HtmlWindow::~HtmlWindow()
{
    delete operations;
}

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    HtmlWindow w;
    w.show();
    return startQtLoop(); // Qt GUI application start the eventloop using startQtLoop() instead of app.exec()
}

And its project file.

# fetch_web_content.pro
TEMPLATE = app
QT += widgets
SOURCES += main.cpp
include(qtnetworkng/qtnetworkng.pri)

As you can see, networking programming is done with very simple API.

License

The QtNetworkNg is distributed under LGPL 3.0 license.

You can obtain a copy of LGPL 3.0 license at: https://www.gnu.org/licenses/lgpl-3.0.en.html

Dependencies

QtNetworkNg require QtCore, QtNetwork to build. SSL and crypto is supported using embedded LibreSSL.

Qt 5 - https://www.qt.io/download

Supported Platforms

Linux, Android and OpenBSD is supported.

Macos, iOS is not tested yet, as I have no mac machines.

Windows is supported partially. Because the Qt eventloop is not very efficient, a separate libev event loop is provided in Linux which is not available in Windows. GZip compression is not supported under Windows if zlib library not present.

QtNetworkNg uses more effective boost::context asm code in arm, arm64, x86, amd64 machines, and uses native ucontext or windows fiber API in other architectures.

Towards 1.0

  • [ ] Complete reference documents
  • [x] Implements an HTTP 1.0 server.
  • [x] HTTP support gzip compression.
  • [x] HttpResponse support stream.
  • [x] Support HTTP proxy and cache.
  • [ ] Built as shared library(DLL)
  • [x] A simple replacement for libev in Windows.
  • [ ] Add more OpenSSL functions.
  • [ ] Support verification/ALPS for https connection.
  • [ ] Support MacOS and iOS platforms.
  • [ ] Remove QtNetwork dependence.

Towards 2.0

  • [ ] Support HTTP/2
  • [ ] Support HTTP/3
  • [ ] Support Kademlia

Building

  1. Clone QtNetworkNg from github as git subrepository.
  2. include qtnetworkng/qtnetworkng.pri in your project.pro file.
  3. include qtnetworkng.h in you cpp files.

How to Contribute

Create a pull request on github.com with your patch, then make a pull request to me.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].