Skip to content

Commit

Permalink
Support TLS connections & update README (#12)
Browse files Browse the repository at this point in the history
Add `--demo` option to connect to demo server.
Add `--unsecure` option for testing purposes.
  • Loading branch information
derekbekoe authored Mar 11, 2019
1 parent f799685 commit 79f01ab
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 135 deletions.
112 changes: 76 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,79 @@
# convey
<p align="center">
<img
src="https://derekb.blob.core.windows.net/public/convey_1.svg"
width="400" border="0" alt="Convey">
</p>
<p align="center">
<a href="https://github.com/derekbekoe/convey/releases"><img src="https://img.shields.io/github/release/derekbekoe/convey.svg?style=flat-square&logo=github&color=%236C63FF" alt="Version"></a>
<a href="https://travis-ci.org/derekbekoe/convey"><img src="https://img.shields.io/travis/derekbekoe/convey/master.svg?style=flat-square&logo=travis" alt="Build Status"></a>
</p>
<div align="center">
<p>A command-line tool that makes sharing pipes between machines easy.</p>
<p>Learn more at <a href="https://blog.derekbekoe.com/convey"><em>Convey: Pipe between machines</em></a></p>
</div>

A command-line tool that makes sharing pipes between machines easy.

```bash
echo "Hello world" | convey
21f50fba373e11e9990a72000872a940
```
```bash
convey 21f50fba373e11e9990a72000872a940
Hello world
```

# Features

- Pipe between hosts with an idomatic interface using the standard `|` symbol.
- Easily pipe files between hosts.
- Does not require any open ports between your clients.
- Supports colors through [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
- Supports Linux, macOS and Windows.
- No dependencies to install.
- Powered by [NATS](https://nats.io/), a CNCF project.

# Getting Started

## Install

**Install on Linux:**
### Linux
```bash
wget -qO convey https://get.convey.sh/linux
chmod +x ~/bin/convey
~/bin/convey -h
```

**Install on Mac OS:**
### macOS
```bash
wget -qO ~/bin/convey https://get.convey.sh/macos
chmod +x ~/bin/convey
~/bin/convey -h
```

**Install on Windows:**
> Download from https://get.convey.sh/windows
### Windows
```powershell
Invoke-WebRequest https://get.convey.sh/windows -OutFile convey.exe
convey -h
```

This will download the latest release for your platform.
Builds are available for the `amd64` architecture.
To directly from GitHub, visit https://github.com/derekbekoe/convey/releases/latest.
## Demo Mode

## Usage
A demo mode is available using the `--demo` flag.

In Terminal 1:
```bash
echo "Hello world" | convey
21f50fba373e11e9990a72000872a940
echo "Hello world" | convey --demo
<ID>
```

In Terminal 2:
```bash
convey 21f50fba373e11e9990a72000872a940
convey --demo <ID>
Hello world
```

## Configuration
Demo mode uses the `demo.nats.io` server over a TLS connection with channels expiring after 30 minutes of creation or 10 minutes of inactivity.

Use this mode for experimental and getting started purposes only.

# Configuration

Set configuration with the `convey configure` command.
```bash
Expand All @@ -52,44 +88,48 @@ NatsURL: nats://localhost:4223
NatsClusterID: test-cluster
```
Use the --config flag on the command line to change the config file if needed.
Use the `--config` flag on the command line to change the config file used if needed.

## Development
```bash
go get -u github.com/derekbekoe/convey
cd $GOPATH/src/github.com/derekbekoe/convey
go run main.go
go build -o bin/convey
```
# NATS Streaming Server

## Host your own NATS Streaming Server
You can host your own [NATS Streaming Server](https://nats.io/documentation/streaming/nats-streaming-intro/) and configure `convey` to use that server.

**Deploy to a local Docker container**
#### Deploy to a local Docker container

```bash
docker run -p 4222:4222 nats-streaming:linux
convey configure --nats-url nats://localhost:4222 --nats-cluster test-cluster
```

**Deploy to an Azure Container Instance**
You will need to use the `--unsecure` flag as TLS will not be enabled through this local container.

note: We only include this as an illustration to keep the command simple as traffic is not encrypted.
# Development

**Set up**
```bash
az container create --image nats-streaming:linux --ports 4222 --ip-address Public -g RG -n nats1
convey configure --nats-url nats://<IPADDRESS>:4222 --nats-cluster test-cluster
go get -u github.com/derekbekoe/convey
cd $GOPATH/src/github.com/derekbekoe/convey
go run main.go
```

## Platform Builds
**Multi-platform Builds**
```bash
go get github.com/mitchellh/gox
gox -ldflags "-X github.com/derekbekoe/convey/cmd.VersionGitCommit=$(git rev-list -1 HEAD) -X github.com/derekbekoe/convey/cmd.VersionGitTag=VERSION" -os="linux darwin" -arch="amd64" -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"
```
See https://golang.org/doc/install/source#environment

## FAQ
# Examples

Click to expand each gif.

**How do I try it out?**
<div style="text-align: center">
<img src="https://derekb.blob.core.windows.net/public/blog_convey_vm_1_top.gif" alt="Convey with Top" border="0" width="445">
<img src="https://derekb.blob.core.windows.net/public/blog_convey_vm_1_filecp.gif" alt="Convey for file piping" border="0" width="445">
<img src="https://derekb.blob.core.windows.net/public/blog_convey_vm_1_ms.gif" alt="Convey with millisecond date" border="0" width="445">
<img src="https://derekb.blob.core.windows.net/public/blog_convey_cloudshell_1.gif" alt="Convey with Cloud Shell" border="0" width="445">
</div>

Start the local container, download convey, specify the configuration then run.
# License

If you'd like to share between multiple devices, host the server in a location where your devices can access.
Convey source code is available under the [MIT License](LICENSE).
7 changes: 7 additions & 0 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ import (
"github.com/spf13/viper"
)

// The NATS URL passed in from command-line
var natsURL string

// The NATS cluster ID passed in from command-line
var natsClusterID string

// Whether short channel names should be used instead of the standard uuid format
var useShortName bool

// Whether the current config file should be overwritten
var forceWrite bool

func init() {
Expand Down
Loading

0 comments on commit 79f01ab

Please sign in to comment.