Update on Overleaf.

This commit is contained in:
jsh77 2021-01-29 14:45:21 +00:00 committed by overleaf
parent 757c06ec16
commit 212bca0ba2
4 changed files with 30 additions and 94 deletions

View File

@ -1,74 +0,0 @@
%!TEX root = ../thesis.tex
% ********************* Thesis Appendix A - Graph Generation **********************
\chapter{Graph Generation Script}
\label{appendix:graph_generation}
\begin{minted}[
fontsize=\footnotesize,
linenos,
breaklines,
]{python}
from itertools import cycle
import matplotlib.pyplot as plt
def plot_iperf_results(
series: Dict[str, StandardTest],
title: str = None,
direction = 'inbound',
error_bars_x=False,
error_bars_y=False,
filename=None,
start_at_zero=True,
):
if filename in ['png', 'eps']:
filename = 'graphs/{}{}{}{}.{}'.format(
'I' if direction == 'inbound' else 'O',
'Ex' if error_bars_x else '',
'Ey' if error_bars_y else '',
''.join(['S{}-{}'.format(i,x.name()) for (i, x) in enumerate(series.values())]),
filename,
)
series = {
k: (directionInbound if direction == 'inbound' else directionOutbound)[v.name()] for (k, v) in series.items()
}
cycol = cycle('brgy')
fig = plt.figure()
axes = fig.add_axes([0,0,1,1])
if title is not None:
axes.set_title(title, pad=20.0 if True in [len(x.test.events) > 0 for x in series.values()] else None)
axes.set_xlabel('Time (s)')
axes.set_ylabel('Throughput (Mbps)')
for k, v in series.items():
data = v.summarise()
axes.errorbar(
data.keys(),
[x/1e6 for x in data.values()],
xerr=([x[0] for x in v.time_range().values()], [x[1] for x in v.time_range().values()]) if error_bars_x else None,
yerr=[x*1.5/1e6 for x in v.standard_deviation().values()] if error_bars_y else None,
capsize=3,
ecolor='grey',
color=next(cycol),
label=k,
)
legend = axes.legend()
if start_at_zero:
axes.set_ylim(bottom=0)
axes.set_xlim(left=0)
if False:
for k, v in events.items():
axes.axvline(k, linestyle='--', color='grey')
axes.annotate(v, (k, 1.02), xycoords=axes.get_xaxis_transform(), ha='center')
if filename is not None:
fig.savefig(filename, bbox_extra_artists=(legend,), bbox_inches='tight', pad_inches=0.3)
\end{minted}

View File

@ -0,0 +1,28 @@
%!TEX root = ../thesis.tex
% ********************** Thesis Appendix A - Language Samples *************************
\chapter{Language Samples}
\label{appendix:language-samples}
\begin{figure}
\inputminted[firstline=1,lastline=48]{cpp}{Preparation/Samples/main.cpp}
\caption{A sample script written in C++ to collect packets from a TUN interface and print them from multiple threads}
\label{fig:cpp-tun-sample}
\end{figure}
\begin{figure}
\ContinuedFloat
\inputminted[firstline=49,lastline=98]{cpp}{Preparation/Samples/main.cpp}
\end{figure}
\begin{figure}
\inputminted{rust}{Preparation/Samples/main.rs}
\caption{A sample script written in Rust to collect packets from a TUN interface and print them from multiple threads}
\label{fig:rust-tun-sample}
\end{figure}
\begin{figure}
\inputminted{go}{Preparation/Samples/main.go}
\caption{A sample script written in Go to collect packets from a TUN interface and print them from multiple threads}
\label{fig:go-tun-sample}
\end{figure}

View File

@ -114,7 +114,7 @@ This section provides means of confronting the threats given in section \ref{sec
\subsection{Message Authentication}
To provide integrity and authentication for each message, I present two choices: a Message Authentication Codes (MACs) or Digital Signatures. A MAC instead combines the data with a shared key using a specific method, before using a one-way hash function to generate a message authentication code, and thus the result is only verifiable by someone with the same private key (Citation Needed). Producing a digital signature for a message uses the private key in public/private keypair to produce a digital signature for a message, stating that the message was produced by the owner of the private key, which can be verified by anyone with the public key \citep[pp. 147-149]{anderson_security_2008}.
To provide integrity and authentication for each message, I present two choices: a Message Authentication Codes (MACs) or Digital Signatures. A MAC instead combines the data with a shared key using a specific method, before using a one-way hash function to generate a message authentication code, and thus the result is only verifiable by someone with the same private key \citep[pp. 352]{menezes_handbook_1997}. Producing a digital signature for a message uses the private key in public/private keypair to produce a digital signature for a message, stating that the message was produced by the owner of the private key, which can be verified by anyone with the public key \citep[pp. 147-149]{anderson_security_2008}.
The comparison is as such: signatures provide non-repudiation, while MACs do not - one can know the owner of which private key signed a message, while anyone with the shared key could have produced an MAC for a message. The second point is that digital signatures are much more computationally complex than MACs, and thus, given that the control of both ends lies with the same party, MAC is the message authentication of choice for this project.
@ -192,24 +192,12 @@ There are two primary advantages to completing this project in C++: speed of exe
The lack of memory safety in C++ is a significant negative of the language. Although C++ would likely be more performant, it is avoided due to the massive incidental complexity of manual memory management.
\begin{figure}
\inputminted{cpp}{Preparation/Samples/main.cpp}
\caption{A sample script written in C++ to collect packets from a TUN interface and print them from multiple threads}
\label{fig:cpp-tun-sample}
\end{figure}
\subsubsection{Rust}
Rust provides advantages over C++ while still maintaining the speed. It is also memory safe, significantly reducing the programming load of searching for memory errors. The Rust sample is given in figure \ref{fig:rust-tun-sample}, and it is pleasantly concise.
For the purposes of this project, the downsides of Rust come from its youthfulness. This is two-faceted: IDE support and Crate stability. Firstly, the IDE support for Rust in my IDEs of choice is provided via a plugin to IntelliJ, and is not as well supported as many other languages. Secondly, the crate available for TUN support (tun-tap\footnote{\url{https://docs.rs/tun-tap/}}) does not yet provide a stable API, which was noticed during the development of even this test program. Between writing the program initially and re-testing it to place in this document, the API of the Crate had changed to the point where my script no longer type checked. Further, the old version had disappeared, and thus I was left with a program that didn't compile or function. Although writing the API for TUN interaction is not an issue, it would reduce portability, as I cannot test on as many systems and platforms as the open source community.
\begin{figure}
\inputminted{rust}{Preparation/Samples/main.rs}
\caption{A sample script written in Rust to collect packets from a TUN interface and print them from multiple threads}
\label{fig:rust-tun-sample}
\end{figure}
\subsubsection{Go}
The final language to evaluate is Go, often written as GoLang. It is the language of choice for this project, with a sample provided in figure \ref{fig:go-tun-sample}. Go is significantly higher level than the other two languages mentioned, and provides a memory management model that is both simpler than C++ and more standardised than Rust.
@ -218,12 +206,6 @@ For the greedy structure of this project, Go's focus on concurrency is extremely
Garbage collection and first order concurrency come together to make the code produced for this project highly readable. The downside of this runtime is that the speed of execution is negatively affected. However, for the purposes of this first production, that compromise is acceptable. By producing code that makes the functionality of the application clear, future implementations could more easily be built to mirror it. As the Go implementation can achieve respectable performance, as shown in section \ref{section:performance-evaluation}, the compromise of using a well-suited high-level language is one worth taking.
\begin{figure}
\inputminted{go}{Preparation/Samples/main.go}
\caption{A sample script written in Go to collect packets from a TUN interface and print them from multiple threads}
\label{fig:go-tun-sample}
\end{figure}
% ------------------------- Requirements Analysis -------------------------- %
\section{Requirements Analysis}
\label{section:requirements-analysis}

View File

@ -175,7 +175,7 @@
%TC:ignore
\begin{appendices} % Using appendices environment for more functunality
\include{GraphGeneration/graphgeneration}
\include{LanguageSamples/languagesamples}
\include{OutboundGraphs/outboundgraphs}
\include{Proposal/proposal}