Skip to content

Installation

chop1k edited this page Feb 16, 2022 · 6 revisions

Getting started

First of all, you need config file because our image not have default config, so if you start image without config it will panic and will not work.

There is 2 ways of getting config:

  • Make your own
  • Use prepared configuration

We recommend check out our prepared configs and choose one that satisfy your needs, if our configs are not satisfy your needs then you can make your own.

All prepared docker-compose files with prepared configs located in configs/kneesocks directory of repository.

If you decided to make your own, read appropriate page of our wiki.

Use docker

Recommended way to use kneesocks is docker. We have both container and docker compose. Official docker image located at docker-hub.

First of all, you need docker installed on your machine. Read official docker installation guide if docker is not installed yes.

Use docker container

If you want to use docker container, you should have your config.

When you start our docker container you need to:

  • Mount config directory, which located at /etc/kneesocks.
  • Expose ports that server will use, it should be port specified in your config. Recommended port is 1080.
  • (optional) Create individual network
  • (recommended) Mount log directory to separate volume. By default logs directory located at /var/log/kneesocks.

First you need to create directory where your configuration file will be located, suppose it will be /srv/kneesocks/config.

mkdir -p /srv/kneesocks/config && cd /srv/kneesocks

Then you need to paste your config file to the config directory. For example we will use our all_enabled_no_restrictions.json file.

curl -o config/config.json https://raw.githubusercontent.com/chop1k/kneesocks/master/configs/kneesocks/all_enabled_no_restrictions/config/config.json

Now, all preparation are done and we can start our container.

docker run -p 1080:1080 -v /srv/kneesocks/config:/etc/kneesocks chop1k/kneesocks

Voila! It should write logs to the console like below.

2022-02-16 10:25:31 INF Listening for udp packets. address=:1080
2022-02-16 10:25:31 INF Listening for tcp connection. address=:1080

Now our socks server is ready and you can use it like you want.

Use docker-compose

If you want to start quick and easy, we recommend using prepared docker-compose files. All prepared docker-compose files with prepared configs located in configs/kneesocks directory of repository.

Suppose that we choose our all_enabled_no_restrictions configuration. First we need to choose directory where we will download our files, suppose that it will be /srv/kneesocks.

mkdir -p /srv/kneesocks/config && cd /srv/kneesocks

Now we need to download docker-compose file.

curl -o docker-compose.yml https://raw.githubusercontent.com/chop1k/kneesocks/master/configs/kneesocks/all_enabled_no_restrictions/docker-compose.yml

Next we need to download our config file.

curl -o config/config.json https://raw.githubusercontent.com/chop1k/kneesocks/master/configs/kneesocks/all_enabled_no_restrictions/config/config.json

Now we need to start our docker container using docker compose.

docker-compose up -d

Voila! Now check logs of the container, there should be logs like below.

2022-02-16 10:25:31 INF Listening for udp packets. address=:1080
2022-02-16 10:25:31 INF Listening for tcp connection. address=:1080

Build from source

For some reasons, docker may not satisfy your needs, then you can build executable file from sources and use it like you want.

First you need to choose directory where you will clone the sources. Suppose that it will be /tmp.

cd /tmp && git clone https://github.com/chop1k/kneesocks && cd kneesocks

Then you need to build executable from sources, golang will automatically download all dependencies.

go build -i -o kneesocks cmd/kneesocks/main.go

Voila! Now check directory, it should contain executable called kneesocks. Now you can use this executable as you want.

NOTE: Default config file location is /etc/kneesocks/config.json, but you can override it by setting config_path environment variable.

Clone this wiki locally