Skip to content

Commit 55d9aa1

Browse files
committed
feat: ✨ Add builtin SSL support
1 parent 002cba2 commit 55d9aa1

31 files changed

+506
-135
lines changed

.config/nextest.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ serial-integration = { max-threads = 1 }
44
[[profile.default.overrides]]
55
filter = 'package(quickfix) + test(test_log_factory)'
66
test-group = 'serial-integration'
7+
8+
[[profile.default.overrides]]
9+
filter = 'package(quickfix) + test(test_send_receive)'
10+
test-group = 'serial-integration'

.github/actions/builder/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ runs:
1414
- uses: cargo-bins/cargo-binstall@main
1515
- name: Install nextest
1616
shell: bash
17-
run: cargo binstall cargo-nextest --secure
17+
run: cargo binstall cargo-nextest --secure --force

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ jobs:
3232
- name: Run tests
3333
run: cargo nextest run
3434

35+
test_ssl:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
submodules: true
41+
- uses: ./.github/actions/builder
42+
- uses: ./.github/actions/rustcSetup
43+
- name: Install dependencies
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install --yes libssl-dev
47+
- name: Run tests
48+
run: cargo nextest run -F build-with-ssl
49+
3550
test_mysql:
3651
runs-on: ubuntu-latest
3752
steps:

.github/workflows/coverage.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ jobs:
2323
with:
2424
components: llvm-tools-preview
2525

26-
- name: Install cargo-llvm-cov
27-
uses: taiki-e/install-action@v2.18.9
28-
with:
29-
tool: cargo-llvm-cov
26+
- uses: taiki-e/install-action@cargo-llvm-cov
27+
- uses: taiki-e/install-action@nextest
3028

3129
- name: Generate code coverage
32-
run: cargo llvm-cov --workspace --exclude quickfix-ffi --ignore-filename-regex quickfix-ffi --all-features --codecov --output-path codecov.json
30+
run: |
31+
cargo llvm-cov nextest \
32+
--workspace \
33+
--exclude quickfix-ffi \
34+
--ignore-filename-regex quickfix-ffi \
35+
--all-features \
36+
--codecov --output-path codecov.json
3337
3438
- name: Upload coverage to Codecov
3539
uses: codecov/codecov-action@v3.1.4

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "quickfix-ffi/libquickfix"]
22
path = quickfix-ffi/libquickfix
3-
url = https://github.com/quickfix/quickfix.git
4-
branch = master
3+
url = https://github.com/zqw86713/quickfix.git
4+
branch = qinweiz

doc/ABOUT.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,41 @@ What is already bind and working in this crate:
1818

1919
What I do **not** plan to bind from this crate:
2020

21-
1. SSL support.
21+
1. Python / Ruby binding.
2222

23-
Use binary like `stunnel` to emulate the feature.
24-
It is simpler to use than the original SSL quickfix, even if it add some performances overhead.
23+
Use original library instead obviously.
2524

26-
2. Python / Ruby binding.
25+
2. Autotools build toolchain.
2726

28-
Use original library instead obviously.
27+
Just use `cmake` once and for all !
28+
We are in 2023+ and not targeting OS from the 80s.
2929

30-
3. Autotools build toolchain.
30+
3. FIX 5x messages generated code.
3131

32-
Just use `cmake` once and for all !
33-
We are in 2023+ and not targeting OS from the 80s.
32+
FIX 5x XML definition is a little bit weird ...
33+
For example:
3434

35-
4. FIX 5x messages generated code.
35+
- In [MatchType](https://www.onixs.biz/fix-dictionary/5.0/tagNum_574.html) some tag is defined multiple times.
36+
Generated enum are so inconsistent and cannot be safely generated.
37+
- There are probably other incompatibility but I stopped here ...
3638

37-
FIX 5x XML definition is a little bit weird ...
38-
For example:
39-
- In [MatchType](https://www.onixs.biz/fix-dictionary/5.0/tagNum_574.html) some tag is defined multiple times.
40-
Generated enum are so inconsistent and cannot be safely generated.
41-
- There are probably other incompatibility but I stopped here ...
39+
You can edit XML spec to your need and create a package with desired spec locally.\
40+
Check FAQ for more info on this.
4241

43-
You can edit XML spec to your need and create a package with desired spec locally.\
44-
Check FAQ for more info on this.
42+
4. All binding of `LogFactory`.
4543

46-
5. All binding of `LogFactory`.
44+
I just provide Rust standard trait.
45+
You can implement whatever you want using standard Rust crate and impl 3 callbacks (logger / redis / syslog / sql / ...).
4746

48-
I just provide Rust standard trait.
49-
You can implement whatever you want using standard Rust crate and impl 3 callbacks (logger / redis / syslog / sql / ...).
47+
Moreover Rust file descriptor are protected by mutex, so this avoid mixing log from C++ / Rust in the same program.
5048

51-
Moreover Rust file descriptor are protected by mutex, so this avoid mixing log from C++ / Rust in the same program.
52-
53-
6. Custom `MessageStoreFactory` from rust.
49+
5. Custom `MessageStoreFactory` from rust.
5450

5551
For now, only `FileMessageStoreFactory` and `MemoryMessageStoreFactory` are bind.
5652
You can use also use `MySqlMessageStoreFactory` and `PostgresMessageStoreFactory` when enabling crate feature flag.
5753
Implementing message store from rust side is a little bit tricky and I am not 100% sure of the correct way to proceed.
5854

59-
7. Exotic operating system.
55+
6. Exotic operating system.
6056

61-
AIX / Solaris are not targeted.
62-
They are not Rust [Tier1](https://doc.rust-lang.org/nightly/rustc/platform-support.html) for now.
57+
AIX / Solaris are not targeted.
58+
They are not Rust [Tier1](https://doc.rust-lang.org/nightly/rustc/platform-support.html) for now.

examples/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ Because it is the simplest one to setup and it has a sandbox to play with.
88

99
## Getting started
1010

11-
1. Install [`stunnel`](https://www.stunnel.org/).
12-
2. Run it with `stunnel ./examples/stunnel.conf`.
13-
3. Create a API token to [Coinbase sandbox API](https://public.sandbox.exchange.coinbase.com/profile/api) with:
11+
1. Create a API token to [Coinbase sandbox API](https://public.sandbox.exchange.coinbase.com/profile/api) with:
1412
- Trade permission
1513
- Your IP
16-
4. Setup following env variables:
14+
2. Setup following env variables:
1715
- `COINBASE_API_KEY`
1816
- `COINBASE_API_PASSPHRASE`
1917
- `COINBASE_API_SECRET`
20-
5. Check the code and update to your need.
21-
6. Add some fund to your [sandbox portfolio](https://public.sandbox.exchange.coinbase.com/portfolios).
22-
7. Launch the `coinbase-example` app 🚀 !!!
18+
3. Check the code and update to your need.
19+
4. Add some fund to your [sandbox portfolio](https://public.sandbox.exchange.coinbase.com/portfolios).
20+
5. Launch the `coinbase-example` app 🚀 !!!
2321

2422
## Including code from github instead of crates.io
2523

examples/coinbase-example/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub fn build_session_settings(config: &CoinbaseConfig) -> anyhow::Result<Session
1818
&StartTime("00:00:01"),
1919
&EndTime("23:59:59"),
2020
&HeartBtInt(30),
21-
&SocketConnectPort(5298), // ⚠️ This port should match what you have in your stunnel configuration file.
22-
&SocketConnectHost("127.0.0.1"),
21+
&SocketConnectPort(4198),
22+
&SocketConnectHost("fix-public.sandbox.exchange.coinbase.com"),
2323
&DataDictionary("data/order-entry/FIX42-prod-sand.xml"),
2424
])?,
2525
)?;
@@ -30,8 +30,8 @@ pub fn build_session_settings(config: &CoinbaseConfig) -> anyhow::Result<Session
3030
&StartTime("00:00:01"),
3131
&EndTime("23:59:59"),
3232
&HeartBtInt(30),
33-
&SocketConnectPort(7221), // ⚠️ This port should match what you have in your stunnel configuration file.
34-
&SocketConnectHost("127.0.0.1"),
33+
&SocketConnectPort(6121),
34+
&SocketConnectHost("fix-md.sandbox.exchange.coinbase.com"),
3535
&DataDictionary("data/order-entry/FIX42-prod-sand.xml"),
3636
&DefaultApplVerID("9" /* FIX 5.0 SP2 */),
3737
&DataDictionary("data/market-data/FIX50-prod-sand.xml"),

examples/stunnel.conf

Lines changed: 0 additions & 39 deletions
This file was deleted.

quickfix-ffi/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED True)
66
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/libquickfix/cmake/")
77

8+
option(HAVE_SSL "Build with SSL" OFF)
89
option(HAVE_MYSQL "Build with MySQL" OFF)
910
option(HAVE_POSTGRESQL "Build with PostgreSQL" OFF)
1011

1112
option(QUICKFIX_BIND_EXAMPLES "Build quickfix C binding examples" ON)
1213

14+
if (HAVE_SSL)
15+
find_package(OpenSSL REQUIRED)
16+
include_directories(${OPENSSL_INCLUDE_DIR})
17+
message("-- Building with OpenSSL")
18+
endif()
19+
1320
if (HAVE_MYSQL)
1421
find_package(MySQL REQUIRED)
1522
include_directories(${MYSQL_INCLUDE_DIR})

0 commit comments

Comments
 (0)