Greg Hurrell [Thu, 16 Dec 2021 21:24:31 +0000 (22:24 +0100)]
docs: move media into media/ subdirectory
Seeing as selective rendering doesn't work on another branch. Seems host
dependent: relative paths like this work, and GitHub has this example
working:
I can't say I am thrilled about the `gh-` prefix on this thing, because
it means the README is going to look good on GitHub, but not on other
mirrors, like GitLab, unless they decide to also support this particular
"vendor prefix".
Greg Hurrell [Tue, 16 Jun 2020 22:04:23 +0000 (00:04 +0200)]
Merge branch 'pull/21'
Closes: https://github.com/wincent/clipper/pull/21
* pull/21:
docs: update "Authors" and "History" sections
refactor: make log file directory on all platforms
feat: automatically create the default log directory if required
Greg Hurrell [Tue, 16 Jun 2020 20:18:24 +0000 (22:18 +0200)]
refactor: make log file directory on all platforms
I don't see any reason why this should be limited to Linux, so remove
the platform check.
Additionally, check the error condition and blow up if we can't make the
directory. Finally, remove "config" from the variable name because it
may not be a `~/.config` directory at all.
Greg Hurrell [Tue, 18 Dec 2018 21:13:07 +0000 (22:13 +0100)]
Document use of socat
As noted in the related issue, this can be useful (or necessary) on
systems without `nc` or with version of `nc` (GNU, for example) that
doesn't support the `-U` switch.
Greg Hurrell [Thu, 4 Oct 2018 11:29:54 +0000 (13:29 +0200)]
Prepare for v2.0.0 release
Bumping the major version because there *may* be somebody out there
relying on the old behavior (ie. they have an empty `--flags` value and
are getting the default).
Greg Hurrell [Thu, 4 Oct 2018 11:18:30 +0000 (13:18 +0200)]
Overhaul flag/config handling to deal with empty values
We were previously conflating non-emptiness of flags and config values
with being-set. This meant that you couldn't explicitly set a value to
an empty string, because we would interpret that as the value not being
set and we would fall back to the default. This is a problem if you
want, for example, to suppress all `--flags` being sent to the
underlying `--executable`.
Fix this by replacing our simple string and int variables with struct
wrappers that contain both the value and an explicit boolean that
indicates whether the value was provided. This requires us to implement
the `flag.Value` interface on our wrapper structs, and also the
`json.Unmarsheler` interface so that we can unpack from the JSON config
file into these custom structs.
In addition to fixing the issue, these changes make the code in the
`mergeSettings()` function look simpler and more fool-proof now. Only
downside is we need a bit of boilerplate-ish code to implement those
interfaces. Error messages when providing malformed JSON are about as
good as they used to be:
clipper: 2018/10/04 13:15:31 json: cannot unmarshal object into Go
struct field Options.Address of type string
Greg Hurrell [Fri, 17 Nov 2017 16:31:09 +0000 (08:31 -0800)]
doc: make it clear that StreamLocalBindUnlink should be set on the server
I've never found it to work on the client, but it does work on the
server. It wasn't clear to me from the docs that this would be the case
because the wording is almost identical for both `sshd_config`:
StreamLocalBindUnlink
Specifies whether to remove an existing Unix-domain
socket file for local or remote port for- warding before
creating a new one. If the socket file already exists and
StreamLocalBindUnlink is not enabled, sshd will be unable to
forward the port to the Unix- domain socket file. This option
is only used for port forwarding to a Unix-domain socket file.
The argument must be yes or no. The default is no.
and `ssh_config`:
StreamLocalBindUnlink
Specifies whether to remove an existing Unix-domain
socket file for local or remote port for- warding before
creating a new one. If the socket file already exists and
StreamLocalBindUnlink is not enabled, ssh will be unable to
forward the port to the Unix- domain socket file. This option
is only used for port forwarding to a Unix-domain socket file.
The argument must be yes or no (the default).
I'm thinking that perhaps the client side config only applies to
port-forwarding (or the socket on the local side), and the server config
applies to reverse port forwarding (or the the socket on the remote
side).
So I've now done this three ways to see which one sucks less. The lack
of generics makes this one feel a bit ridiculous, but at least the main
body reads nicely now.
Note also the pass-by-reference shennanigans to avoid making a copy of
the listener objects (I don't even know what that would mean, although I
want to try it out and find out: maybe Go only makes a copy of the
slice, not the slice items, when you pass a slice by value).
But in the case where we try to listen on the IPv4 and IPv6 loopback
addresses, we're fine with up to one of those failing, but not both.
This `listenerCount` variable is ugly, but I don't know Go idioms. I
think I might just pull it out into a separate loop for clarity (in a
language with a generic `filter` function I would just use that to strip
out `nil` and then look at the `len`).
Greg Hurrell [Wed, 30 Nov 2016 14:58:58 +0000 (06:58 -0800)]
Merge branch 'pull/4'
Closes: https://github.com/wincent/clipper/pull/4
* pull/4:
doc: Engage in word-smithery
doc: Fix Linux set-up instructions
Move Linux contrib files under contrib/linux
update linux service script
add systemd script support for linux
Greg Hurrell [Wed, 30 Nov 2016 14:46:22 +0000 (06:46 -0800)]
doc: Fix Linux set-up instructions
- Typo: "cliper" -> "clipper".
- Fix paths: service expects clipper to be in `/usr/local/bin`, not
`~/bin`.
- Note likely need to use `sudo`.
- Kill off unnecessary blank lines.
Greg Hurrell [Tue, 29 Nov 2016 07:00:53 +0000 (23:00 -0800)]
Drop "shorthand" from usage
Mostly so I can add "default" information to the `--address`/`-a`
option, even though the actual default is an empty string and so usually
wouldn't show.
Greg Hurrell [Tue, 29 Nov 2016 06:54:58 +0000 (22:54 -0800)]
Listen on IPv4 and IPv6 by default
As noted [here](https://github.com/golang/go/issues/9334#issuecomment-67098831), the "correct way" to listen on both IPv4 and IPv6 loopback interfaces is to omit the address part.
Closes: https://github.com/wincent/clipper/issues/2
And will also close: https://github.com/wincent/vim-clipper/issues/1
Greg Hurrell [Tue, 29 Nov 2016 06:36:48 +0000 (22:36 -0800)]
Merge branch 'pull/3'
Closes: https://github.com/wincent/clipper/pull/3
* pull/3:
Rename --args/-r to --flags/-f
Add --executable and --args flags
Rename ClipApp{,Args} to Executable,Args
doc: update for OS X -> macOS, and Linux support
Treat ClipAppArgs independently of ClipApp
Handle variable whitespace in ClipAppArgs
Reformat some comments for consistency
Kill an excess empty line in the Makefile
doc: Update "Authors" and "History" sections
add support for linux clipboard
Greg Hurrell [Tue, 29 Nov 2016 06:30:49 +0000 (22:30 -0800)]
Rename --args/-r to --flags/-f
I don't want to reimplement `flag.PrintDefaults` in order to get
appropriately grouped usage information, so I am renaming this flag to
so that the long and short forms both begin with the same letter.
"Flag" is unfortunately pretty overloaded at this point, and we already
have a bit of a cluster going on with "Settings", "Options", "Defaults",
and "Flags", but this is the way things are for now: because of the way
JSON marshalling works, we have to have names which match the desired
options.
Greg Hurrell [Tue, 29 Nov 2016 06:20:21 +0000 (22:20 -0800)]
Add --executable and --args flags
Alas, `--args` must break with the pattern of having the short option
start with the same letter as the long option (ie. `-a`); instead it
uses `-r`. This makes the `--help`/`-h` output a bit "meh"; not sure if
there's a way to fix that. If I can't find one I might need to rename
this option to `--flags`/`-f` or `--options`/`-o`.
Greg Hurrell [Tue, 29 Nov 2016 02:05:36 +0000 (18:05 -0800)]
Treat ClipAppArgs independently of ClipApp
You might conceivably want to set one without setting the other. For
example, on OS X, you might want to keep `pbcopy`, but instead use
`-pboard find` (for some crazy reason).
This isn't exposed as a command-line flag right now, so the only way you
could do such a thing would be to provide a custom JSON config file.
Greg Hurrell [Fri, 3 Jun 2016 15:39:34 +0000 (08:39 -0700)]
Add real -h and --help flags
You would get help output before this if you typed "-h" or "--help" (or "-help")
but only because you were seeing the failure output. In other words,
"--random-crap" would show you exactly the same output.
Let's use real flags here instead, and exit cleanly with a 0 exit code.
So I am not worried about breaking that, but I do want to show a couple of clear
examples of how to set this up via TCP ports or UNIX domain sockets.
Note that I also updated the paths to use `/usr/local/bin` instead of `/usr/bin`
or a relative PATH because of Apple's SIP (System Integrity Protection) that
makes it much less likely that people will be able to write to the latter.
Greg Hurrell [Fri, 3 Jun 2016 01:43:43 +0000 (18:43 -0700)]
Make option overrides a little more predictable
Switching to structs instead of independent variables to make it more obvious
what's going on with overrides. Note the motivating use case here, which is
making sure that only things which look like paths end up getting converted to
absolute paths and used.
Greg Hurrell [Thu, 2 Jun 2016 16:03:59 +0000 (09:03 -0700)]
Update links in README
Promote GitHub project page to "official" status, simplify `go build`
invocatioe, mention other mirrors, and drop references to binary builds, which I
am unlikely to offer moving forward, given the prevalence of Homebrew in the
target market for which those executables existed (OS X power users).
Greg Hurrell [Thu, 2 Jun 2016 16:03:29 +0000 (09:03 -0700)]
Optionally listen on a UNIX domain socket
If `--address` (or "address" in the config file) looks like a path (ie. starts
with "/" or "~") then Clipper will listen on a UNIX domain socket at that path
rather than on a port.
Motivation: better security, because the socket can be protected via filesystem
permissions, whereas the TCP port is accessible to any user that has access to
localhost.
Netcat can be configured to talk to a UNIX socket (via `-U`), and it's possible
to forward local sockets using SSH as well, given a sufficiently recent version
of SSH, so everything can continue to work as before.
I'm going to run with this instead of my half-made passphrase-based solution,
for now, because the latter has a bunch of issues (need to exchange a shared
secret at start-time, and updating it may be tricky in the presence of
long-lived tmux sessions etc).
This is still a WIP, however, as we have some issues to work through. For
example, command-line options should trump config file options (we currently do
the opposite) and it all needs to be documented still. Also, the code is
frickin' ugly (it's been so long since I programmed in Go, I had to Google "how
do I X?" about 20 times while preparing this tiny change).
Greg Hurrell [Thu, 2 Jun 2016 15:22:16 +0000 (08:22 -0700)]
Catch signals in order to perform exit cleanup
Want to do this because I'm about to add support for listening on UNIX domain
sockets, and those need to be cleaned up at exit in order to avoid havoc.
doc: Mention changes to execution context in Yosemite
Note that the stuff about execution context only applies pre-Yosemite.
Clipper is still useful, however, even on Yosemite, because it provides
you with a uniform interface to the clipboard for both local and remote
hosts.
Wincent Colaiuta [Mon, 10 Feb 2014 04:02:32 +0000 (20:02 -0800)]
Add section about Mosh to the docs
This commit adds some tips on getting Mosh, SSH and Clipper playing
nicely together. I include the section about the various `Control*`
settings because they are a complicating variable which needs to be
dealt with.
(In general, the `Control*` settings are a great time saver, but they
can make trouble-shooting difficult and we can simplify the business of
setting up a "pure-forwarder" for use with Mosh by keeping them out of
the picture.)