Skip to content

Instantly share code, notes, and snippets.

View voidlizard's full-sized avatar

Dmitry Zuikov voidlizard

View GitHub Profile
;; hbs2-peer config file
; listen "0.0.0.0:84"
listen "0.0.0.0:7354"
listen-tcp "tcp://0.0.0.0:3001"
download-threads 1
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE NumericUnderscores #-}
module Main where
import HBS2.Prelude.Plated
import HBS2.Net.Messaging
import HBS2.Net.Messaging.Pipe
glob :: forall m . MonadIO m
=> [FilePattern] -- ^ search patterns
-> [FilePattern] -- ^ ignore patterns
-> FilePath -- ^ directory
-> (FilePath -> m Bool) -- ^ file action
-> m ()
glob pat ignore dir action = do
q <- newTQueueIO
void $ liftIO (async $ go q dir >> atomically (writeTQueue q Nothing))
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PolyKinds #-}
module Main where
import HBS2.Actors.Peer
import HBS2.Clock
import HBS2.Net.Messaging.Unix
import HBS2.Net.Proto
import Test.Tasty.HUnit
instance HasFabriq UNIX (ReaderT (AnyStorage, MessagingUnix) IO) where
getFabriq = asks (Fabriq . snd)
instance HasOwnPeer UNIX (ReaderT (AnyStorage, MessagingUnix) IO) where
ownPeer = asks ( msgUnixSelf . snd)
instance Monad m => HasStorage (ReaderT (AnyStorage, MessagingUnix) m) where

hexcapt

Краткое описание работы

Сервис hexcapt осуществляет работу captive portal следующим образом:

  • Маркирует сетевые соединения, используя заданный при помощи API уровень доступа (см.конфигурирование)
  • Запускает заданное число DNS прокси с заданными настройками, для осуществления различного разрешения адресов в зависимости от заданных режимов
module Main where
import System.TimeIt
import Data.ByteString.Lazy qualified as LBS
import Data.ByteString qualified as BS
import Data.ByteString.Lazy (ByteString)
import Crypto.Random (getRandomBytes)
import Control.Monad
import Data.Functor
import Data.Function
module Main where
import System.TimeIt
import Data.ByteString.Lazy qualified as LBS
import Data.ByteString qualified as BS
import Data.ByteString.Lazy (ByteString)
import Crypto.Random (getRandomBytes)
import Control.Monad
import Data.Functor
import Data.Function
module Main where
import System.TimeIt
import Data.ByteString.Lazy qualified as LBS
import Data.ByteString qualified as BS
import Data.ByteString.Lazy (ByteString)
import Crypto.Random (getRandomBytes)
import Control.Monad
import Data.Functor
import Data.Function
withState do
transactional do
sz <- getDataSizeFromMeta
ref <- getStateRefFromMeta
withState $ insertProcessed htx
rdb <- withState (selectRank rv)