Skip to content

Instantly share code, notes, and snippets.

@mehdok
mehdok / pivpn_with_stunnel.md
Created August 17, 2023 21:15 — forked from JimmieD/pivpn_with_stunnel.md
PiVPN with stunnel

Using PiVPN with Stunnel

Intro

The following are steps to setting up PiVPN with stunnel. Why would you want to do this? OpenVPN is subject to blocking by several methods of deep packet inspection since OpenVPN traffic, though encrypted, looks slightly different than normal web traffic. If your OpenVPN works, you probably don't need this. But if it is being blocked, you will probably have to wrap your OpenVPN connection in an SSL tunnel to make it look like normal web traffic. For an explation see here: https://proprivacy.com/guides/how-to-hide-openvpn-traffic-an-introduction

The following are steps needed to wrap your OpenVPN in an SSL connection wtih a Linux server (I got it working in ubuntu 18.04; looks to only work with amd64 architecture, not armhf). So far I've only used with a Windows client, so I don't know the exact config for an Android, iOS, Mac, or Linux client.

@mehdok
mehdok / AppDelegate.swift
Last active August 12, 2019 10:15
Swift implementation of SocketChannel of https://pub.dev/packages/flutter_socket_io
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
var socketChannel: SocketChannel!
override func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GeneratedPluginRegistrant.register(with: self)
socketChannel = SocketChannel(window)
cd "$SRCROOT/KotlinSharedNetwork-android"
./gradlew :SharedNetwork:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION} -Pkotlin.device="$KOTLIN_DEVICE"
targets {
// Read the "kotlin.device" variable passed by Xcode
def isSim = findProperty("kotlin.device") == "iosSim"
// Apply the preset according to the device
def iosPreset = isSim ? presets.iosX64 : presets.iosArm64
fromPreset(iosPreset, 'iOS') {
binaries {
framework('SharedNetwork')
def rx_swift
pod 'RxSwift', '~> 4.4'
end
target 'RKProfile' do
use_frameworks!
workspace 'REKAB'
project 'RKProfile/RKProfile.xcodeproj'
rx_swift
import UIKit
public protocol StoryboardInitializable {
static var storyboardIdentifier: String { get }
}
public extension StoryboardInitializable where Self: UIViewController {
public static var storyboardIdentifier: String {
return String(describing: Self.self)
}
public var rx_startLoading: AnyObserver<Bool> {
return Binder(self, binding: { [weak self] (view, visible) in
self?.showLoaingLayer(show: visible)
}).asObserver()
}
var postList = BehaviorRelay<[Post]?>(value: nil)
postList.bindTo(to: showList).disposed(by: bag)
yourButton.rx.tap.asObservable().bind(to: viewModel.someObserver).disposed(by: bag)
var isLoading: Bool = false {
didSet {
showLoading()
}
}