f05e346
Name:       trojan
f05e346
Version:    1.16.0
e9b398f
Release:    %autorelease
f05e346
Summary:    An unidentifiable mechanism that helps you avoid censorship
f05e346
f05e346
#GPLv3+ with opelssl exceptions
f05e346
License:    GPLv3+
f05e346
URL:        https://github.com/trojan-gfw/%{name}
f05e346
Source0:    %{URL}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
f05e346
# signature from release page
f05e346
Source1:    %{URL}/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
f05e346
# keyid obtained from upstream auther's GitHub profile
f05e346
Source2:    https://pgp.key-server.io/0xA1DDD486533B0112
f05e346
3ff5885
# see: https://github.com/trojan-gfw/trojan/pull/473
3ff5885
# Changes/CMake to do out-of-source builds F33 make tests fail
3ff5885
# this is a workaround
3ff5885
Patch0:     0001-Avoid-a-race-condition-that-makes-the-test-to-fail.patch
3ff5885
f05e346
# for build
f05e346
BuildRequires:    gcc
f05e346
BuildRequires:    gcc-c++
f05e346
BuildRequires:    make
f05e346
BuildRequires:    cmake >= 3.7.2
f05e346
BuildRequires:    boost-devel >= 1.66.0
f05e346
BuildRequires:    openssl-devel >= 1.1.0
f05e346
BuildRequires:    mariadb-devel
f05e346
%if 0%{?fedora} >= 30
f05e346
BuildRequires:    systemd-rpm-macros
f05e346
%else
f05e346
BuildRequires:    systemd
f05e346
%endif
f05e346
# for test
f05e346
BuildRequires:    python3
f05e346
BuildRequires:    nmap-ncat
f05e346
BuildRequires:    curl
f05e346
BuildRequires:    openssl
f05e346
#for verifying the tarball
f05e346
BuildRequires:    gnupg2
f05e346
f05e346
f05e346
%description
f05e346
An unidentifiable mechanism that helps you avoid censorship.
f05e346
f05e346
Trojan features multiple protocols over TLS to avoid both 
f05e346
active/passive detection and ISP QoS limitations.
f05e346
f05e346
Trojan is not a fixed program or protocol. It's an idea, 
f05e346
an idea that imitating the most common service, 
f05e346
to an extent that it behaves identically, 
f05e346
could help you get across the Great FireWall permanently, 
f05e346
without being identified ever.
f05e346
f05e346
f05e346
%prep
f05e346
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
3ff5885
%autosetup
f05e346
# change cipher list in shipped configuration file&example into PROFILE=SYSTEM
f05e346
sed -i '/"cipher"/c\        "cipher": "PROFILE=SYSTEM",' examples/*.json-example
f05e346
sed -i '/"cipher_tls13"/c\        "cipher_tls13": "PROFILE=SYSTEM",' examples/*.json-example
3b4d87f
sed -e '/User=nobody/ s/^#*/# /;/User=nobody/i # User=nobody is not recommended\n# You can use systemctl edit trojan to re-enable this\n# While DynamicUser=yes is suggested\n#' -i examples/trojan.service-example
f05e346
f05e346
%build
0eb03f0
%cmake
0eb03f0
%cmake_build
f05e346
f05e346
%install
0eb03f0
%cmake_install
f05e346
f05e346
%check
0eb03f0
%ctest
f05e346
f05e346
%post
f05e346
%systemd_post %{name}.service
f05e346
f05e346
%preun
f05e346
%systemd_preun %{name}.service
f05e346
f05e346
%postun
f05e346
%systemd_postun_with_restart %{name}.service
f05e346
f05e346
f05e346
%files
f05e346
%{_bindir}/%{name}
f05e346
%license LICENSE
f05e346
%dir %{_sysconfdir}/%{name}
f05e346
%dir %{_pkgdocdir}
f05e346
%config(noreplace) %{_sysconfdir}/%{name}/config.json
f05e346
%{_mandir}/man1/%{name}.1.*
f05e346
%{_pkgdocdir}/*
f05e346
%{_unitdir}/%{name}.service
f05e346
%{_unitdir}/%{name}@.service
f05e346
f05e346
f05e346
%changelog
e9b398f
%autochangelog