diff --git a/trippy/README.md b/trippy/README.md new file mode 100644 index 0000000..4c71368 --- /dev/null +++ b/trippy/README.md @@ -0,0 +1,55 @@ +--- +title: Trippy +homepage: https://github.com/fujiapple852/trippy +tagline: | + Trippy: A tool that combines the functionality of traceroute and ping designed for networking issue analysis. +--- + +To update or switch versions, run `webi trippy@stable` (or `@v2`, `@beta`, etc). + +### Files + +These are the files / directories that are created and/or modified with this +install: + +```text +~/.config/trippy/config.toml +~/.local/bin/trippy +~/.local/opt/trippy-vX.X.X +``` + +## Cheat Sheet + +> Trippy combines the functionality of traceroute and ping to assist in +> analyzing networking issues. It supports multiple protocols such as ICMP, UDP, +> and TCP, and is equipped with a Tui interface for detailed analysis. + +To run Trippy: + +```sh +trippy [options] +``` + +### Trace Using Multiple Protocols + +To trace using ICMP: + +```sh +trippy --protocol ICMP +``` + +### Customizable Tracing Options + +To set packet size & payload pattern: + +```sh +trippy --packet-size 64 --payload-pattern "pattern" +``` + +### Tui Interface + +Launch Trippy with the Tui interface: + +```sh +trippy --tui +``` diff --git a/trippy/install.ps1 b/trippy/install.ps1 new file mode 100644 index 0000000..85eb14c --- /dev/null +++ b/trippy/install.ps1 @@ -0,0 +1,61 @@ +#!/usr/bin/env pwsh + +################## +# Install trippy # +################## + +# Every package should define these variables +$pkg_cmd_name = "trippy" + +$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\trippy.exe" +$pkg_dst = "$pkg_dst_cmd" + +$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\trippy-v$Env:WEBI_VERSION\bin\trippy.exe" +$pkg_src_bin = "$Env:USERPROFILE\.local\opt\trippy-v$Env:WEBI_VERSION\bin" +$pkg_src_dir = "$Env:USERPROFILE\.local\opt\trippy-v$Env:WEBI_VERSION" +$pkg_src = "$pkg_src_cmd" + +New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null +$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" + +# Fetch archive +IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE")) +{ + echo "Downloading trippy from $Env:WEBI_PKG_URL to $pkg_download" + & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part" + & move "$pkg_download.part" "$pkg_download" +} + +IF (!(Test-Path -Path "$pkg_src_cmd")) +{ + echo "Installing trippy" + + # TODO: create package-specific temp directory + # Enter tmp + pushd .local\tmp + + # Remove any leftover tmp cruft + Remove-Item -Path ".\trippy-v*" -Recurse -ErrorAction Ignore + Remove-Item -Path ".\trippy.exe" -Recurse -ErrorAction Ignore + + # NOTE: DELETE THIS COMMENT IF NOT USED + # Move single binary into root of temporary folder + #& move "$pkg_download" "trippy.exe" + + # Unpack archive file into this temporary directory + # Windows BSD-tar handles zip. Imagine that. + echo "Unpacking $pkg_download" + & tar xf "$pkg_download" + + # Settle unpacked archive into place + echo "Install Location: $pkg_src_cmd" + New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null + Move-Item -Path ".\trippy-*\trippy.exe" -Destination "$pkg_src_bin" + + # Exit tmp + popd +} + +echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'" +Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null +Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse diff --git a/trippy/install.sh b/trippy/install.sh new file mode 100644 index 0000000..b63fa5f --- /dev/null +++ b/trippy/install.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# shellcheck disable=SC2034 +# "'pkg_cmd_name' appears unused. Verify it or export it." + +__init_trippy() { + set -e + set -u + + ################## + # Install trippy # + ################## + + # Every package should define these 6 variables + pkg_cmd_name="trippy" + + pkg_dst_cmd="$HOME/.local/bin/trippy" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/trippy-v$WEBI_VERSION/bin/trippy" + pkg_src_dir="$HOME/.local/opt/trippy-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + # pkg_install must be defined by every package + pkg_install() { + # ~/.local/opt/trippy-v0.99.9/bin + mkdir -p "$(dirname "${pkg_src_cmd}")" + + # mv ./trippy-*/trippy ~/.local/opt/trippy-v0.99.9/bin/trippy + mv ./trippy-*/* "${pkg_src_cmd}" + } + + # pkg_get_current_version is recommended, but not required + pkg_get_current_version() { + # 'trippy --version' has output in this format: + # trippy 0.99.9 (rev abcdef0123) + # This trims it down to just the version number: + # 0.99.9 + trippy --version 2> /dev/null | + head -n 1 | + cut -d ' ' -f 2 + } + +} + +__init_trippy diff --git a/trippy/releases.js b/trippy/releases.js new file mode 100644 index 0000000..55b0f72 --- /dev/null +++ b/trippy/releases.js @@ -0,0 +1,20 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'fujiapple852'; +var repo = 'trippy'; + +module.exports = function (request) { + return github(request, owner, repo).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + // just select the first 5 for demonstration + all.releases = all.releases.slice(0, 5); + console.info(JSON.stringify(all, null, 2)); + }); +}