This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <boost/asio.hpp> | |
| #include <boost/asio/co_spawn.hpp> | |
| #include <boost/asio/detached.hpp> | |
| #include <boost/asio/use_awaitable.hpp> | |
| #include <iostream> | |
| #include <chrono> | |
| #include <thread> | |
| #include <sstream> | |
| #include <iomanip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import subprocess | |
| import re | |
| # ==================== 配置项 ==================== | |
| EXCLUDE_DIRS = { | |
| 'test', 'apps', 'doc', 'demos', 'fuzz', 'util', 'os-dep', | |
| 'vms', 'ms', 'tools', 'bugs', 'external' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::vector<uint8_t> data = | |
| { | |
| 0x00, 0x00, 0xed, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x3f, 0xe1, 0x3f, 0x88, 0x61, 0x96, 0xdc, 0x34, 0xfd, 0x28, 0x17, 0x54, 0xca, 0x3a, 0x94, 0x10, 0x04, 0xe2, 0x81, 0x72, 0xe3, 0x6d, 0x5c, 0x03, 0x8a, 0x62, 0xd1, 0xbf, 0x5f, 0x87, 0x49, 0x7c, 0xa5, 0x89, 0xd3, 0x4d, 0x1f, 0x6c, 0x96, 0xdc, 0x34, 0xfd, 0x28, 0x26, 0xd4, 0xd4, 0x44, 0xa8, 0x20, 0x09, 0xb5, 0x00, 0xf5, 0xc6, 0x9d, 0xb8, 0x16, 0x94, 0xc5, 0xa3, 0x7f, 0x0f, 0x13, 0x8c, 0xfe, 0x5c, 0x7a, 0x52, 0x3c, 0x57, 0xc4, 0xb0, 0x5e, 0x8d, 0xaf, 0xe7, 0x52, 0x84, 0x8f, 0xd2, 0x4a, 0x8f, 0x0f, 0x0d, 0x83, 0x71, 0x91, 0x35, 0x40, 0x8f, 0xf2, 0xb4, 0x63, 0x27, 0x52, 0xd5, 0x22, 0xd3, 0x94, 0x72, 0x16, 0xc5, 0xac, 0x4a, 0x7f, 0x85, 0x02, 0xe0, 0x00, 0x99, 0x77, 0x78, 0x8c, 0xa4, 0x7e, 0x56, 0x1c, 0xc5, 0x81, 0x90, 0xb6, 0xcb, 0x80, 0x00, 0x3f, 0x76, 0x86, 0xaa, 0x69, 0xd2, 0x9a, 0xfc, 0xff, 0x40, 0x85, 0x1d, 0x09, 0x59, 0x1d, 0xc9, 0x8f, 0x9d, 0x98, 0x3f, 0x9b, 0x8d, 0x34, 0xcf, 0xf3, 0xf6, 0xa5, 0x23, 0x81, 0x97, 0x00, 0x0f, 0x7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // g++ -std=c++23 foo.cpp -lssl -lcrypto -lnghttp2 -lpthread | |
| #include <boost/assert.hpp> | |
| #include <boost/asio.hpp> | |
| #include <boost/asio/ssl.hpp> | |
| #include <nghttp2/nghttp2.h> | |
| #include <atomic> | |
| #include <cstring> | |
| #include <deque> | |
| #include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as net from 'net'; | |
| // TCP 连接类,仅处理发送和接收 | |
| export class TcpConnection { | |
| // Socket 由外部传入 | |
| private socket: net.Socket; | |
| // 存储接收到的数据 | |
| private buffer: Buffer; | |
| // 读取数据限制, 0 表示无限制 | |
| private readLimit: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // jsonrpc.hpp | |
| // ~~~~~~~~~~~ | |
| // | |
| // Copyright (c) 2023 Jack (jack dot wgm at gmail dot com) | |
| // | |
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 需要安装以下依赖: | |
| * yarn add ethers bitcoinjs-lib ecpair tiny-secp256k1 bs58 | |
| * yarn add @types/bitcoinjs-lib @types/ecpair @types/tiny-secp256k1 @types/bs58 | |
| * yarn add ts-node typescript | |
| */ | |
| import { ethers } from 'ethers'; | |
| import { ECPairFactory } from 'ecpair'; | |
| import bitcoin from 'bitcoinjs-lib'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <fstream> | |
| #include <iostream> | |
| #include <string> | |
| #include <vector> | |
| #include "async_simple/coro/Lazy.h" | |
| #include "async_simple/coro/SyncAwait.h" | |
| // asio_coro_util.hpp 在 demo_example 下, 这里仅仅为了调用 AsioCallbackAwaiter 这个简单的 Awaiter 而已. | |
| #include "asio_coro_util.hpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <coroutine> | |
| #include <functional> | |
| #include <type_traits> | |
| #if defined(DEBUG) || defined(_DEBUG) | |
| #include <unordered_set> | |
| std::unordered_set<void*> global_crors; | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ssl_stream.hpp | |
| // ~~~~~~~~~~~~~~ | |
| // | |
| // Copyright (c) 2023 Jack (jack dot wgm at gmail dot com) | |
| // | |
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| // |
NewerOlder