Telegram proxy (mtproto)
Using https://github.com/telemt/telemt You would need a docker installed on your VPS. We want to start a proxy on :3443.
|
1 2 3 |
mkdir telemt cd telemt vi ./docker-compose.yml |
docker-compose.yml
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
services: telemt: image: whn0thacked/telemt-docker:latest container_name: telemt restart: unless-stopped environment: - RUST_LOG=info volumes: - ./telemt.toml:/etc/telemt.toml:ro ports: - "3443:3443/tcp" security_opt: - no-new-privileges:true cap_drop: - ALL cap_add: - NET_BIND_SERVICE read_only: true tmpfs: - /tmp:rw,nosuid,nodev,noexec,size=16m |
generate a random secret
|
1 2 3 |
openssl rand -hex 16 # or head -c 16 /dev/urandom | xxd -ps |
|
1 |
vi ./telemt.toml |
telemt.toml (update values in [])
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
### Telemt Based Config.toml # We believe that these settings are sufficient for most scenarios # where cutting-egde methods and parameters or special solutions are not needed # === General Settings === [general] use_middle_proxy = false # Global ad_tag fallback when user has no per-user tag in [access.user_ad_tags] ad_tag = "[your random secret]" # Per-user ad_tag in [access.user_ad_tags] (32 hex from @MTProxybot) # === Log Level === # Log level: debug | verbose | normal | silent # Can be overridden with --silent or --log-level CLI flags # RUST_LOG env var takes absolute priority over all of these log_level = "normal" [general.modes] classic = true secure = false tls = false [general.links] show = "*" # show = ["alice", "bob"] # Only show links for alice and bob # show = "*" # Show links for all users public_host = "[your VPS public host]" # Host (IP or domain) for tg:// links public_port = 3443 # Port for tg:// links (default: server.port) # === Server Binding === [server] port = 3443 # proxy_protocol = false # Enable if behind HAProxy/nginx with PROXY protocol # metrics_port = 9090 # metrics_listen = "0.0.0.0:9090" # Listen address for metrics (overrides metrics_port) # metrics_whitelist = ["127.0.0.1", "::1", "0.0.0.0/0"] [server.api] enabled = true listen = "0.0.0.0:9091" whitelist = ["127.0.0.0/8"] minimal_runtime_enabled = false minimal_runtime_cache_ttl_ms = 1000 # Listen on multiple interfaces/IPs - IPv4 [[server.listeners]] ip = "0.0.0.0" # === Anti-Censorship & Masking === [censorship] tls_domain = "www.microsoft.com" mask = true tls_emulation = true # Fetch real cert lengths and emulate TLS records tls_front_dir = "tlsfront" # Cache directory for TLS emulation mask_port = 443 [access.users] # format: "username" = "32_hex_chars_secret" hello = "[your random secret]" |
|
1 2 3 |
docker compose up -d # wait a few seconds docker logs telemt|grep tg: |
Don’t forget to allow this port in your VPS’ firewall:
|
1 |
ufw allow 3443/tcp |
It will give you a link to be used …
golang banchmarks with benchstat
Here I will show how to run a benchmark in go1.24 and compare 2 implementations.
Cheapest VPS hostings (could be suitable for VPN)
https://lowendbox.com/blog/1-vps-1-usd-vps-per-month/
Improve your MacOS experience while using external displays
A couple of apps: https://github.com/waydabber/BetterDisplay — free https://displaybuddy.app/ — about $20 for one license.
Install Mac OS from a flash stick
Useful links: https://www.macworld.com/article/671308/how-to-create-a-bootable-usb-macos-installer.html https://support.apple.com/en-us/101578 https://support.apple.com/en-us/102662 https://support.apple.com/en-us/102655 To create a bootable flash drive for a system that is not supported on your current system, you can use one of those: https://github.com/ninxsoft/Mist?tab=readme-ov-file (I prefer this one) and https://dortania.github.io/OpenCore-Legacy-Patcher/INSTALLER.html#downloading-the-installer
Go code reviews best practices
https://go.dev/wiki/CodeReviewComments https://google.github.io/styleguide/go/decisions
MacOS issue — a lot of purgeable disk space
I used to have an issue — about 300Gb of extra disk space occupied on my MacBook labeled as «pergeable» (on my MacOS Sonoma). There are a lot of suggestion on the internet, but only 2 of them worked for me. First, I synced my backups with 2 of my TimeMachines (one of them was …
Golang’s sync.Map internals
Great article on the topic — https://victoriametrics.com/blog/go-sync-map/index.html. The whole series of articles is solid, so please take a look if you are interested. Let me share the most important insights. How it works Internal structure is:
|
1 2 3 4 5 6 |
type Map struct { mu Mutex read atomic.Pointer[readOnly] dirty map[any]*entry misses int } |
MVC, MVP, MVVM, MVVM-C, and VIPER architecture patterns comparison
Great diagram comparing MVC, MVP, MVVM, MVVM-C, and VIPER architecture patterns from ByteByteGo: They also provide the following description: — MVC, the oldest pattern, dates back almost 50 years — Every pattern has a «view» (V) responsible for displaying content and receiving user input — Most patterns include a «model» (M) to manage business data …
Cleanlinter — my first golang linter
I’ve implemented my first go linter, called cleanlinter — https://github.com/bullgare/cleanlinter. It’s a simplistic linter to check golang project internal imports according to Clean Architecture pattern. Installation
|
1 |
go install github.com/bullgare/cleanlinter/cmd/cleanlinter@latest |
Usage
|
1 2 3 4 5 6 |
cleanlinter \ -cleanlinter_path_to_domain=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/domain \ -cleanlinter_path_to_usecase=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/usecase \ -cleanlinter_path_to_adapter=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/adapter \ -cleanlinter_path_to_infra=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/infra \ ./... |
To be honest, writing proper integration tests made much more time than just writing the linter. Articles, discussions, examples that helped me: https://developer20.com/custom-go-linter/ https://stackoverflow.com/questions/72933175/go-get-filepath-from-ast-file https://github.com/bkielbasa/cyclop/blob/master/pkg/analyzer/analyzer.go https://github.com/alingse/asasalint/blob/main/asasalint_test.go