%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis
% LaTeX Template
% Version 2.5 (27/8/17)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel (vel@latextemplates.com)
%
% This template is based on a template by:
% Steve Gunn
% (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%  PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[
  11pt, % The default document font size, options: 10pt, 11pt, 12pt
  oneside,%twoside, % Two side (alternating margins) for binding by default,
  % uncomment to switch to one side
  english, % ngerman for German
  onehalfspacing, % Single line spacing, alternatives: onehalfspacing
  % or doublespacing
  %draft, % Uncomment to enable draft mode (no pictures, no links,
  % overfull hboxes indicated)
  %nolistspacing, % If the document is onehalfspacing or
  % doublespacing, uncomment this to set spacing in lists to single
  %liststotoc, % Uncomment to add the list of figures/tables/etc to
  % the table of contents
  %toctotoc, % Uncomment to add the main table of contents to the
  % table of contents
  parskip, % Add space between paragraphs and remove indentation
  %nohyperref, % Uncomment to not load the hyperref package
  headsepline, % Uncomment to get a line under the header
  chapterinoneline, % Place the chapter title next to the number on one line
  %consistentlayout, % Uncomment to change the layout of the
  % declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure

% Fix chapter prefix for chapterinoneline option
\makeatletter
\renewcommand{\mdtChapapp}{\@chapapp\space}
\renewcommand{\autodot}{:}
\makeatother

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{float}
\usepackage{mathpazo} % Use the Palatino font by default
\usepackage{svg}
\usepackage{acronym}
\usepackage{subcaption} % For subfigures
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage[edges]{forest}
\usepackage{listings} % Source code listings for evidence snippets
% Syntax-highlighting colors (xcolor is already loaded by the class file)
\definecolor{lstKeyword}{HTML}{0B5FA5}
\definecolor{lstComment}{HTML}{4B7B4D}
\definecolor{lstString}{HTML}{A31515}
\definecolor{lstNumber}{HTML}{707070}
\definecolor{lstBackground}{HTML}{F7F7F7}
\definecolor{lstFrame}{HTML}{C8C8C8}
\lstset{
  basicstyle=\ttfamily\footnotesize,
  keywordstyle=\color{lstKeyword}\bfseries,
  commentstyle=\color{lstComment}\itshape,
  stringstyle=\color{lstString},
  numberstyle=\tiny\color{lstNumber},
  identifierstyle=\color{black},
  backgroundcolor=\color{lstBackground},
  rulecolor=\color{lstFrame},
  breaklines=true,
  breakatwhitespace=false,
  columns=fullflexible,
  keepspaces=true,
  showstringspaces=false,
  frame=single,
  framerule=0.4pt,
  xleftmargin=0.5em,
  xrightmargin=0.5em,
  aboveskip=0.6em,
  belowskip=0.6em,
  captionpos=b,
}
\lstdefinelanguage{Nix}{
  morekeywords={with,let,in,inherit,rec,if,then,else,import,true,false,null},
  morecomment=[l]{\#},
  morestring=[b]",
  sensitive=true,
}
\lstdefinelanguage{Rust}{
  morekeywords={as,break,const,continue,crate,else,enum,extern,false,fn,for,
    if,impl,in,let,loop,match,mod,move,mut,pub,ref,return,self,Self,static,
    struct,super,trait,true,type,unsafe,use,where,while,async,await,dyn,
  Some,None,Option,Result,Ok,Err,Duration},
  morecomment=[l]{//},
  morecomment=[s]{/*}{*/},
  morestring=[b]",
  sensitive=true,
}
\lstdefinelanguage{Go}{
  morekeywords={break,case,chan,const,continue,default,defer,else,fallthrough,
    for,func,go,goto,if,import,interface,map,package,range,return,select,
    struct,switch,type,var,bool,byte,complex64,complex128,error,float32,
    float64,int,int8,int16,int32,int64,rune,string,uint,uint8,uint16,uint32,
    uint64,uintptr,true,false,iota,nil,append,cap,close,complex,copy,delete,
  imag,len,make,new,panic,print,println,real,recover},
  morecomment=[l]{//},
  morecomment=[s]{/*}{*/},
  morestring=[b]",
  morestring=[b]`,
  sensitive=true,
}

\usepackage[backend=bibtex,style=numeric,natbib=true]{biblatex} %
% Use the bibtex backend with the authoryear citation style (which
% resembles APA)

\addbibresource{example.bib} % The filename of the bibliography
\addbibresource{master_citations.bib}

\usepackage[autostyle=true]{csquotes} % Required to generate
% language-dependent quotes in the bibliography

\newcommand{\bitem}[1]{
\item \textbf{#1}}

\setcounter{secnumdepth}{0} % Only number chapters, not sections or subsections

%----------------------------------------------------------------------------------------
%  MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
  paper=a4paper,
  inner=3.0cm,       % Bindungsseite – braucht mehr Platz
  outer=2.5cm,       % Außenseite
  bindingoffset=0.5cm, % Zusätzlich für Klebebindung
  top=2.5cm,
  bottom=2.0cm,
}

%----------------------------------------------------------------------------------------
%  THESIS INFORMATION
%----------------------------------------------------------------------------------------

\thesistitle{An Analysis of P2P VPN Implementation} % Your thesis
% title, this is used in the title
% and abstract, print it elsewhere with \ttitle
%\supervisor{\textsc{Ber Lorke}} % Your supervisor's name, this is
% used in the title page, print it elsewhere with \supname
\examiner{Prof. Dr. \textsc{Stefan Schmid}} % Your examiner's name,
% this is not currently used anywhere in the template, print it
% elsewhere with \examname
\degree{Master of Computer Science} % Your degree name, this is used
% in the title page and abstract, print it elsewhere with \degreename
\author{\textsc{Luis Hebendanz}} % Your name, this is used in the
% title page and abstract, print it elsewhere with \authorname

\subject{Computer Science} % Your subject area, this is not currently
% used anywhere in the template, print it elsewhere with \subjectname
\keywords{Decentralized Networks} % Keywords for your thesis, this is
% not currently used anywhere in the template, print it elsewhere
% with \keywordnames
\university{\href{https://www.tu.berlin/}{TU Berlin}} % Your
% university's name and URL, this is used in the title page and
% abstract, print it elsewhere with \univname
\department{\href{https://www.tu.berlin/eninet}{Internet Architecture
and Management}} % Your department's name and URL, this is used in
% the title page and abstract, print it elsewhere with \deptname
\group{\href{https://www.tu.berlin/eninet}{INET}} % Your research
% group's name and URL, this is used in the title page, print it
% elsewhere with \groupname
\faculty{\href{https://www.tu.berlin/eecs}{Faculty IV}} % Your
% faculty's name and URL, this is used in the title page and
% abstract, print it elsewhere with \facname

\AtBeginDocument{
  \hypersetup{pdftitle=\ttitle} % Set the PDF's title to your title
  \hypersetup{pdfauthor=\authorname} % Set the PDF's author to your name
  \hypersetup{pdfkeywords=\keywordnames} % Set the PDF's keywords to
  % your keywords
}

\begin{document}

\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for
% the pre-content pages

\pagestyle{plain} % Default to the plain heading style until the
% thesis style is called for the body content

%----------------------------------------------------------------------------------------
%  TITLE PAGE
%----------------------------------------------------------------------------------------

\begin{titlepage}
  \begin{center}

    \vspace*{.06\textheight}
    {\scshape\LARGE \univname\par}\vspace{1.5cm} % University name
    \textsc{\Large Master Thesis}\\[0.5cm] % Thesis type

    \HRule \\[0.4cm] % Horizontal line
    {\huge \bfseries \ttitle\par}\vspace{0.4cm} % Thesis title
    \HRule \\[1.5cm] % Horizontal line

    \begin{minipage}[t]{0.4\textwidth}
      \begin{flushleft} \large
        \emph{Author:}\\
        \textcolor{mdtRed}{\authorname}
      \end{flushleft}
    \end{minipage}
    \begin{minipage}[t]{0.4\textwidth}
      \begin{flushright} \large
        \emph{First Examiner:} \\
        \textcolor{mdtRed}{Prof.\ Dr.\ \textsc{Stefan Schmid}}\\[1em]
        \emph{Second Examiner:} \\
        \textcolor{mdtRed}{\textsc{[TBD]}}\\[1em]
        %\emph{Supervisor:} \\
        %\textcolor{mdtRed}{\supname}
      \end{flushright}
    \end{minipage}\\[2cm]

    \vfill

    \large \textit{A thesis submitted in fulfillment of the
    requirements\\ for the degree of \degreename}\\[0.3cm] %
    % University requirement text
    \textit{in the}\\[0.4cm]
    \groupname\\\deptname\\[2cm] % Research group name and department name

    \vfill

    {\large \today}\\[4cm] % Date
    % \includegraphics{./TU-Berlin-Logo.png} % University/department
    % logo - uncomment to place it

    \vfill
  \end{center}
\end{titlepage}

%----------------------------------------------------------------------------------------
%  DECLARATION PAGE
%----------------------------------------------------------------------------------------

\begin{declaration}
  \addchaptertocentry{\authorshipname} % Add the declaration to the
  % table of contents
  \noindent I, \authorname, declare that this thesis titled,
  \enquote{\ttitle} and the work presented in it are my own. I confirm that:

  \begin{itemize}
    \item This work was done wholly or mainly while in candidature
      for a research degree at this University.
    \item Where any part of this thesis has previously been submitted
      for a degree or any other qualification at this University or
      any other institution, this has been clearly stated.
    \item Where I have consulted the published work of others, this
      is always clearly attributed.
    \item Where I have quoted from the work of others, the source is
      always given. With the exception of such quotations, this
      thesis is entirely my own work.
    \item I have acknowledged all main sources of help.
    \item Where the thesis is based on work done by myself jointly
      with others, I have made clear exactly what was done by others
      and what I have contributed myself.\\
  \end{itemize}

  \noindent Signed:\\
  \rule[0.5em]{25em}{0.5pt} % This prints a line for the signature

  \noindent Date:\\
  \rule[0.5em]{25em}{0.5pt} % This prints a line to write the date
\end{declaration}

%----------------------------------------------------------------------------------------
%  ABSTRACT PAGE
%----------------------------------------------------------------------------------------

\begin{abstract}
  \addchaptertocentry{\abstractname} % Add the abstract to the table of contents

  This thesis evaluates ten peer-to-peer mesh VPN implementations
  under controlled network conditions using a reproducible, Nix-based
  benchmarking framework built on a deployment system called Clan.
  The implementations range from kernel-level protocols (WireGuard,
  used as a reference baseline) to userspace overlays (Tinc,
  Yggdrasil, Nebula, Hyprspace, and others).  We test each against
  four impairment profiles that vary packet loss, reordering, latency,
  and jitter, producing over 300 measurements across seven benchmarks
  from raw TCP and UDP throughput to video streaming and
  application-level downloads.

  A central finding is that no single metric captures VPN performance:
  the rankings shift depending on whether one measures throughput,
  latency, retransmit behavior, or application-level transfer time.
  Under network impairment, Tailscale (via Headscale) outperforms the
  Linux kernel's default networking stack, an anomaly we trace to its
  userspace IP stack's tuned congestion-control and buffer parameters.
  Re-running the internal baseline with matching kernel-side tuning
  closes the gap, confirming the explanation.  The accompanying source
  code analysis uncovered a critical security vulnerability in one of
  the evaluated implementations.

\end{abstract}

\input{Chapters/Zusammenfassung}

%----------------------------------------------------------------------------------------
%  ACKNOWLEDGEMENTS
%----------------------------------------------------------------------------------------

\begin{acknowledgements}
  \addchaptertocentry{\acknowledgementname} % Add the
  % acknowledgements to the table of contents

  I am very grateful to my work colleagues Mic92, Lassulus, Hsjobeki, Enzime,
  DavHau and Pinpox with whom I worked together to create the Clan framework.
  As well as my supervisor, Ber Lorke, for his guidance and support
  during my research.
  His advice and feedback have been invaluable.
  I also want to thank my examiner, Prof. Stefan Schmidt, for his
  helpful comments and insights.
  A big thank you to my family and friends for their support and
  encouragement throughout this journey.
  Lastly, thanks to everyone at INET for creating a great learning environment.

\end{acknowledgements}

%----------------------------------------------------------------------------------------
%  LIST OF CONTENTS/FIGURES/TABLES PAGES
%----------------------------------------------------------------------------------------

\tableofcontents % Prints the main table of contents

%\listoffigures % Prints the list of figures

%\listoftables % Prints the list of tables

%----------------------------------------------------------------------------------------
%  PHYSICAL CONSTANTS/OTHER DEFINITIONS
%----------------------------------------------------------------------------------------

% \begin{constants}{lr@{${}={}$}l} % The list of physical constants
% is a three column table

% % The \SI{}{} command is provided by the siunitx package, see its
% documentation for instructions on how to use it

% % Speed of Light & $c_{0}$ & \SI{2.99792458e8}{\meter\per\second} (exact)\\
% %Constant Name & $Symbol$ & $Constant Value$ with units\\

% \end{constants}

%----------------------------------------------------------------------------------------
%  SYMBOLS
%----------------------------------------------------------------------------------------

% \begin{symbols}{lll} % Include a list of Symbols (a three column table)

%   % $a$ & distance & \si{\meter} \\
%   % $P$ & power & \si{\watt} (\si{\joule\per\second}) \\
%   %Symbol & Name & Unit \\

%   \addlinespace % Gap to separate the Roman symbols from the Greek

%   % $\omega$ & angular frequency & \si{\radian} \\

% \end{symbols}

%----------------------------------------------------------------------------------------
%  DEDICATION
%----------------------------------------------------------------------------------------

% \dedicatory{Dedicated to/To my\ldots}

%----------------------------------------------------------------------------------------
%  THESIS CONTENT - CHAPTERS
%----------------------------------------------------------------------------------------

\mainmatter % Begin numeric (1,2,3...) page numbering

\pagestyle{thesis} % Return the page headers back to the "thesis" style

% Include the chapters of the thesis as separate files from the Chapters folder
% Uncomment the lines as you write the chapters
\include{Chapters/Introduction}
\include{Chapters/Background}
\include{Chapters/Methodology}
\include{Chapters/Results}
\include{Chapters/Discussion}
\include{Chapters/Conclusion}

%\include{Chapters/Chapter1}
%\include{Chapters/Chapter2}
%\include{Chapters/Chapter3}
%\include{Chapters/Chapter4}
%\include{Chapters/Chapter5}

%----------------------------------------------------------------------------------------
%  THESIS CONTENT - APPENDICES
%----------------------------------------------------------------------------------------

\appendix % Cue to tell LaTeX that the following "chapters" are Appendices

% Include the appendices of the thesis as separate files from the
% Appendices folder
% Uncomment the lines as you write the Appendices

\chapter{Abbreviations}
\begin{acronym}[P2P] % [P2P] aligns entries to the longest label
  \acro{P2P}{Peer to Peer}
\end{acronym}

%\include{Appendices/AppendixA}
%\include{Appendices/AppendixB}
%\include{Appendices/AppendixC}

%----------------------------------------------------------------------------------------
%  BIBLIOGRAPHY
%----------------------------------------------------------------------------------------

\printbibliography[heading=bibintoc]

%----------------------------------------------------------------------------------------

\end{document}
