Giter Club home page Giter Club logo

gsyn's Introduction

Gsyn

Gsyn is a CLI application to copy files fast and secure.

Table of contents

Installation

To install the the gsyn, you can build the project from source or use prebuilt binaries

Prebuilt binaries

todo

Building from source

To install gsyn from source, you should have Go and protoc installed first.

Then clone this repository:

git clone https://github.com/aigic8/gsyn

After that, generate protobuf files using:

cd ./gosyn/api
chmod +x ./generate_pb.sh
./generate_pb.sh

Then you can build the project using:

cd ./gsyn/cmd/gsyn
go build

Configuration

Configuration path

Gsyn searches for config file in these locations:

  • /etc/gsyn/config.toml
  • $HOME/.config/gsyn/config.toml

Also you can use -c flag in serve command to load configuration from a custom location.

Writing a Configuration file

Gsyn uses TOML as config language.

# Client Part
[client]
defaultTimeout = 5000 # optional, default timeout in milliseconds, default is 5000
defaultWorkers = 10 # optional, default golang workers to be used, default is 10

[client.servers.us]
GUID = "6a480a86-eea5-481d-bbae-5c4417519320" # required, client UUID, should match server
address = "https://1.2.3.4:8686" # required, server address can be IP or hostname
certificates = ["/path/to/cert/cert.der"] #optional, valid certificates for specific server. If empty, system default certificates will be used

# Server part
[server]
address = ":8686" # required, server address
certPath = "/path/to/cert.pem" # required, certificate file
privPath = "/path/to/key.pem" # required, certificate private key
users = [
  { 
    GUID = "6a480a86-eea5-481d-bbae-5c4417519320", # required, should match client UUID
    spaces = ["music"] # required, list of spaces user is authorized to access
  }
]

# server spaces, spaceName = "path/to/space"
[server.spaces]
music = "/home/user/spaces/music"
movies = "/home/user/spaces/movies"

Config file consists of two parts client and server. You only need to write the part you are using. client is used when you are using gsyn as client (for example with cp command) and server is used when you are running on server (for example with serve command)

Generating Certificates

If you are using Gsyn with a valid domain, you can use CertBot or acme.sh to generate a trusted certificate. You only need to pass that to your server configuration.

But if you are using your server IP address, you need to generate a self signed certificate for your ip address and pass that to both client and server. (You can technically generate a trusted certificate for an IP address, but I could not find any free ways) You can generate a self signed certificate using openssl:

openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \  
  -keyout key.pem -out cert.pem -subj "/CN=localhost" \
  -addext "subjectAltName=DNS:localhost,IP:1.2.3.4"

replace 1.2.3.4 with you server IP address.

Then export a DER output for client:

openssl x509 -outform der -in ./cert.pem -out ./cert.der

Server certificates should be in PEM format. But for client, DER format should be used.

Usage

Commands

  • serve starts a server
  • cp copies content. Works like a normal copy command.

Path structure

In Gsyn, a path has structure server:space/path/to/file where

  • server is server name
  • space is space name

Examples

# copying every mp4 file from musics folder to local computer
gsyn cp server:space/musics/*.mp4 .

# copying and replacing if file exists (forced copy)
gsyn cp -f ./truth.mp4 server:/space/musics

# copying multiple files from multiple servers
gsyn cp server:space/musics/truth.mp4 server2:ss/musics/wish-you-where-here.mp4 .

# copying from local to server
gsyn cp ./truth.mp4 server:space/musics

# copying from one server to another
gsyn cp server:space/musics.truth.mp4 server2:ss/musics

gsyn's People

Contributors

aigic8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.