Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
.*.swp
.DS_Store
12 changes: 12 additions & 0 deletions modules/speedtestv2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2018 dhtech
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file


def generate(host, *args):

info = {}
return {'speedtestv2': info}

# vim: ts=4: sts=4: sw=4: expandtab
Binary file added modules/speedtestv2/files/downloading.html
Binary file not shown.
25 changes: 25 additions & 0 deletions modules/speedtestv2/files/hosted.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Speedtest by OpenSpeedtest.com</title>
<style>
::-webkit-scrollbar {
display: none;
}
html {
-ms-overflow-style: none;
scrollbar-width: none;
}
body{margin: 0px;}
</style>
</head>
<body>
<iframe id="OST-iFrame" src="//openspeedtest.com/selfhosted" style="width: 100vw;height: 100vh;" frameborder="0" allowfullscreen></iframe>
<div style="text-align: center; color: rgb(125 119 119); font-size:14px; ">
<a href="https://openspeedtest.com?ref=Self-Hosted-Widget&Run" style="text-decoration:none; color: rgb(125 119 119);"">Speed Test</a> by OpenSpeedTest™
</div>
</body>
</html>
167 changes: 167 additions & 0 deletions modules/speedtestv2/files/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SpeedTest by OpenSpeedTest™</title>
<meta name="description"
content="Test your network speed now. HTML5 Network Performance Estimation Tool. Self-Hosted SpeedTest by OpenSpeedTest™"/>
<link href="assets/css/app.css" rel="stylesheet" type="text/css" />
<script> window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(document.head.innerHTML+='<link id="darkmode" rel="stylesheet" href="assets/css/darkmode.css" type="text/css"/>');function getCookieValue(b,a){return(a=document.cookie.match("(^|;)\\s*"+b+"\\s*=\\s*([^;]+)"))?a.pop():""}if("light"===getCookieValue("mode")){var darkStyle=document.getElementById("darkmode");darkStyle&&darkStyle.parentNode.removeChild(darkStyle)}; </script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta property="og:image" content="assets/images/img.png" />
<link rel='canonical' href='https://openspeedtest.com'/>
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/icons/favicon-16x16.png">
<link rel="manifest" href="assets/images/icons/site.webmanifest">
<link rel="mask-icon" href="assets/images/icons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="assets/images/icons/favicon.ico">
<meta name="msapplication-TileColor" content="#ffc40d">
<meta name="msapplication-config" content="assets/images/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<script type="text/javascript">
/*
Official Website : https://OpenSpeedTest.COM | Email: [email protected]
Developed by : Vishnu | https://Vishnu.Pro | Email : [email protected]

HTML5 Network Performance Estimation Tool -> [JS,XHR,SVG,HTML,CSS]
Started in 2011 and Moved to OpenSpeedTest.COM, Dedicated Project/Domain Name in 2013.
SpeedTest Script -> 2013 -> Beta | 2015 -> V1 | 2019 ->V2 | 2020 V2.1 | 2021 V2.12 | 2022 V2.5 & 2.5.3
Self-Hosted OpenSpeedTest-Server (iFrame/Nginx) -> 2014. (Managed SelfHosted SpeedTesT Widget)
OpenSpeedTest-Server (On-premises) (Fully SelfHosted Apps)
[OpenSpeedTest-Server Docker Image] -> V1 2019 | V2 2020 | V2.1 2021 | V2.2 & 2.2.2 2022
[Node.js/Electron JS OpenSpeedTest-Server Desktop Apps] -> 2020 V1 | 2021 V2 & V2.1 | 2.1.1 to 2.1.8 2022
[Ionic Android and iOS OpenSpeedTest-Server Mobile Apps] V1.2 to 1.5 2022

Download Now -> https://go.openspeedtest.com/Server

Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate

Speed Test by OpenSpeedTest™️ is Free and Open-Source Software (FOSS) with MIT License.
Read full license terms @ http://go.openspeedtest.com/License

If you have any Questions, ideas or Comments Please Send it via -> https://go.openspeedtest.com/SendMessage
*/

// Add or Remove Server --> Automatically choose the one with the least latency
var openSpeedTestServerList = [
{"ServerName":"Home", "Download":"downloading", "Upload":"upload", "ServerIcon":"DefaultIcon"}
];

// Send pings 'pingSamples' times to each Server URL.
var pingSamples = 10;

// 50% samples(Least)/length 1=100% 0.1 = 10%
var jitterFinalSample = 0.5;

// Set a pingSample dynamically by passing "Ping" or "p" as a URL Parameter.
var setPingSamples = true;

// If Server has not responded within 5 Seconds for any requests we send ('pingSamples' times)
// We will show Network Error. You can change the limit here.
// In milliseconds, if you need to set 6 seconds. Change the value to 6000.
var pingTimeOut = 5000;

// Set a PingTimeout dynamically by passing "Out" or "O" as a URL Parameter
var setPingTimeout = true;

// GET or HEAD // Other Methods may work. but why?
var pingMethod = "GET";

//Choose Download or Upload from the Server list. If you Prefer Download, change pingMethod to HEAD.
var pingFile = "Upload";

// The amount of garbage data sent to the server in Mb, 30 = 30Mb
var ulDataSize = 30;

// Don't touch it
var ulDelay = 300;
var dlDelay = 300;

// Overhead Compensation factor, This is a browser-dependent test, Many Unknowns. Currently, 4%. That is within the margin of error.
var upAdjust = 1.04;
var dlAdjust = 1.04;

// You can pass "Clean" or "C" as a URL Parameter and reset the Overhead Compensation factor to Zero or set any value between 0 and 4. 1 = 1% to 4 = 4%
// "clean" will not accept values above 4, so Compensation is limited to a maximum of 4%.
var enableClean = true;

// Minimum 12 Seconds is Expected.
var dlDuration = 12;
var ulDuration = 12;

// 6 is the common limit found on most browsers.
// Choose Number for parallel HTTP connections to Server | Default is 6
var dlThreads = 6;
var ulThreads = 6;

// Allow user to Change default limit of 6 parallel HTTP connections to Server | Accept values above 1 and max 32
// pass "XHR" or "X" as a URL Parameter
var setHTTPReq = true;

// Save Data to a Database
var saveData = false;
var saveDataURL = "//yourDatabase.Server.com:4500/save?data=";

// Allow user to change the default 12 seconds test duration
// Pass "Stress" or "S" as a URL Parameter.
var stressTest = true;

// Allow user to select and run one test at a time, download, upload, or ping
// Pass "Test" or "T" as a URL Parameter.
var selectTest = true;

// Allow user to select a different server to run a test
// Pass "Host" or "H" ad a URL Parameter.
// Accept only valid HTTP URLs like "http://192.168.1.10:3000" or "https://yourHost.com"
var selectServer = true;

// Start a test Automatically without pressing the start button
// You can Delay the test for 'n' seconds by passing any number as a value for Run Keyword. e.g.: "Run=10" or "R=10" to delay the test by 10 Seconds.
// Pass "Run" or "R" as a URL Parameter to start a test instantly.
var enableRun = true;

// "Run" will not work if you are already using 'selectTest' "Test" or "T" Keyword.


function ostOnload() {
console.log("OpenSpeedTest.com V2.5.4 Loaded!")
console.log("Now Press the Start Button or HIT Enter.")
console.log("The secret to living happy is giving happiness. Have a wonderful day.")

}

var openChannel = "dev";

</script>

<!--
Speed Test by OpenSpeedTest™️ is Free and Open-Source Software with MIT License.

You can play with the CSS, HTML & SVG files to change the colors or add your support desk info to this page.
Also, you can add your company logo anywhere on this page. It's FOSS. You can do whatever you see fit.

If you like to make any other modification to this application or need a custom deployment for your organization,
please get in touch with [email protected].
-->

<div id="loading_app" class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
<object style="visibility:hidden" id="OpenSpeedTest-UI" data="assets/images/app.svg" type="image/svg+xml"></object>

<div class="Credits">
<a href="https://openspeedtest.com?ref=Self-Hosted&Run">SpeedTest by OpenSpeedTest™</a> is a Free and <a href="https://github.com/openspeedtest/Speed-Test">Open-Source HTML5 Network Speed Test</a> Software.
<p style="font-size: 12px;">&copy; Copyright 2013-2024 OpenSpeedTest™ All Rights Reserved.</p>
</div>

<script src="assets/js/app-2.5.4.min.js"></script>
<script src="assets/js/darkmode.js"></script>

</body>
</html>
Empty file.
115 changes: 115 additions & 0 deletions modules/speedtestv2/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright 2024 dhtech
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file
#
# == Class: speedtest
#
# This class manages the speedtest
#
#
# === Parameters
#

class speedtestv2 {

ensure_packages(['ssl-cert', 'nginx'])

file { '/etc/ssl/certs/server-fullchain.crt':
ensure => file,
owner => 'root',
group => 'ssl-cert',
mode => '0644',
source => 'puppet:///letsencrypt/fullchain.pem',
links => 'follow',
notify => Service['nginx'],
}

file { '/etc/ssl/private/server.key':
ensure => file,
owner => 'root',
group => 'ssl-cert',
mode => '0640',
source => 'puppet:///letsencrypt/privkey.pem',
links => 'follow',
notify => Service['nginx'],
}

service { 'nginx':
ensure => 'running',
name => 'nginx',
enable => true,
require => Package['nginx'],
}

file { '/etc/nginx/sites-enabled/default':
ensure =>absent,
force =>true,
notify =>Service['nginx'],
require =>Package['nginx'],
}

file { 'speedtestv2-conf':
ensure => file,
path => '/etc/nginx/sites-enabled/speedtest',
content => template('speedtestv2/speedtest.conf.erb'),
notify => Service['nginx'],
require => Package['nginx'],
}

# Needed for 'ssl-cert' group
ensure_packages(['ssl-cert'])

file { '/etc/ssl/certs/speedtest2.event.dreamhack.se.crt':
ensure => file,
owner => 'root',
group => 'ssl-cert',
mode => '0644',
source => 'puppet:///letsencrypt/fullchain.pem',
links => 'follow',
}

file { '/etc/ssl/private/speedtest2.event.dreamhack.se.key':
ensure => file,
owner => 'root',
group => 'ssl-cert',
mode => '0640',
source => 'puppet:///letsencrypt/privkey.pem',
links => 'follow',
}
file { '/usr/share/nginx/html/speedtestv2-downloading.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/speedtestv2/downloading.html',
}

file { '/usr/share/nginx/html/index.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/speedtestv2/index.html',
}

file { '/usr/share/nginx/html/hosted.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/speedtestv2/hosted.html',
}

file { '/usr/share/nginx/html/upload.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/speedtestv2/upload.html',
}

}



13 changes: 13 additions & 0 deletions modules/speedtestv2/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "speedtestv2",
"version": "0.1.0",
"author": "dhtech",
"summary": "speedtest v2 site",
"license": "BSD",
"source": "",
"project_page": null,
"issues_url": null,
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"}
]
}
15 changes: 15 additions & 0 deletions modules/speedtestv2/templates/nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
worker_processes auto;
worker_rlimit_nofile 100000;
events {
worker_connections 2048;
multi_accept on;
}

error_log /var/log/nginx/error.log notice;
pid /tmp/nginx.pid;

http {
include mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
}
Loading