outline-sdk icon indicating copy to clipboard operation
outline-sdk copied to clipboard

Any way to run Outline client on linux server terminal by command line?

Open alexlii1971 opened this issue 1 year ago • 5 comments

Hello,

We have a server in China, and the server with Ubuntu is limited to access any global resource.

So, is there any way to run outline client on Linux terminal by command line?

Thanks

alexlii1971 avatar Mar 01 '24 04:03 alexlii1971

Hello,

I got the post at https://github.com/Jigsaw-Code/outline-sdk/blob/main/x/examples/outline-cli/README.md

Outline VPN Command-Line Client

A CLI interface of Outline VPN client for Linux.

Usage

go run github.com/Jigsaw-Code/outline-sdk/x/examples/outline-cli@latest -transport "ss://<outline-server-access-key>"
  • -transport : the Outline server access key from the service provider, it should start with "ss://"

Build

You can use the following command to build the CLI.

cd outline-sdk/x/examples/
go build -o outline-cli  -ldflags="-extldflags=-static" ./outline-cli

💡 cgo will pull in the C runtime. By default, the C runtime is linked as a dynamic library. Sometimes this can cause problems when running the binary on different versions or distributions of Linux. To avoid this, we have added the -ldflags="-extldflags=-static" option. But if you only need to run the binary on the same machine, you can omit this option.

You know, we would run it on server temporally, and we need stop outline service running on server after deploy the project.

so, any way to get VPN client outline and down, and stop running?

alexlii1971 avatar Mar 01 '24 04:03 alexlii1971

Hello,

Here is the error on Ubuntu, anyway to fix?

go run github.com/Jigsaw-Code/outline-sdk/x/examples/outline-cli@latest -transport "ss://[email protected]:44194/?outline=1>"

github.com/Jigsaw-Code/outline-sdk/transport

go/pkg/mod/github.com/!jigsaw-!code/[email protected]/transport/happyeyeballs.go:90:22: undefined: atomic.Int32 go/pkg/mod/github.com/!jigsaw-!code/[email protected]/transport/happyeyeballs.go:194:24: undefined: errors.Join go/pkg/mod/github.com/!jigsaw-!code/[email protected]/transport/happyeyeballs.go:242:22: undefined: errors.Join

alexlii1971 avatar Mar 04 '24 04:03 alexlii1971

Hi @alexlii1971 , sorry about the inconvenience, if @latest does not work for you, you can always use the commit ID tag instead, for example:

go run github.com/Jigsaw-Code/outline-sdk/x/examples/outline-cli@7294484

jyyi1 avatar Mar 11 '24 15:03 jyyi1

Hi @jyyi1, having troubles running previous command on Ubuntu 22.04:

# github.com/Jigsaw-Code/outline-sdk/network/lwip2transport
go/pkg/mod/github.com/!jigsaw-!code/[email protected]/network/lwip2transport/device.go:35:13: undefined: lwip.LWIPStack
go/pkg/mod/github.com/!jigsaw-!code/[email protected]/network/lwip2transport/device.go:83:15: undefined: lwip.NewLWIPStack
go/pkg/mod/github.com/!jigsaw-!code/[email protected]/network/lwip2transport/device.go:90:7: undefined: lwip.RegisterOutputFn

cinsort avatar Apr 10 '24 04:04 cinsort

Hi @cinsort , this seems to be a Go or C/C++ compiler issue. We are using a native LwIP network stack defined here: https://github.com/eycorsican/go-tun2socks/blob/master/core/lwip.go#L21-L25 . That requires CGO_ENABLED=1 and a native C/C++ compiler installed in the system. And also GOOS needs to be linux as well.

You may confirm these setting by running go env. Also, please use go version 1.21+ to run the command.

jyyi1 avatar Apr 10 '24 04:04 jyyi1

Hi @cinsort , this seems to be a Go or C/C++ compiler issue. We are using a native LwIP network stack defined here: https://github.com/eycorsican/go-tun2socks/blob/master/core/lwip.go#L21-L25 . That requires CGO_ENABLED=1 and a native C/C++ compiler installed in the system. And also GOOS needs to be linux as well.

You may confirm these setting by running go env. Also, please use go version 1.21+ to run the command.

and what to do?

ElGrats avatar May 28 '24 05:05 ElGrats

[ERROR] 2024/05/28 05:30:05 failed to configure system DNS: failed to backup DNS config file '/etc/resolv.conf.head' to '/etc/resolv.head.outlinecli.backup': rename /etc/resolv.conf.head /etc/resolv.head.outlinecli.backup: no such file or directory

ElGrats avatar May 28 '24 05:05 ElGrats

[ERROR] 2024/05/28 05:30:05 failed to configure system DNS: failed to backup DNS config file '/etc/resolv.conf.head' to '/etc/resolv.head.outlinecli.backup': rename /etc/resolv.conf.head /etc/resolv.head.outlinecli.backup: no such file or directory

Hi @ElGrats , this is a known issue and there is a PR to fix it: https://github.com/Jigsaw-Code/outline-sdk/pull/203. It's not quite ready yet, but feel free to contribute to it!

In the meantime, you can work-around the problem by creating an empty file named /etc/resolv.conf.head.

jyyi1 avatar May 28 '24 20:05 jyyi1

What do I do with this error?

# go run github.com/Jigsaw-Code/outline-sdk/x/examples/outline-cli@latest -transport "ss://Y2hhY2hh[...hidden...]wNzU0#127+%D0%92%D1%81%D1%8F%D0%BA%D0%B8%D0%B9"
OutlineVPN CLI (experimental)
[INFO] 2024/07/24 22:06:25 updated global IPv6 support: false
[INFO] 2024/07/24 22:06:25 updated global IPv6 support: true
[ERROR] 2024/07/24 22:06:25 failed to create OutlineDevice: invalid server hostname: lookup Y2hhY2hh[...hidden...]wNzU0: no such host

It looks like it's trying to resolve the entire encoded string as a hostname.

adequacy1 avatar Jul 24 '24 19:07 adequacy1

Hi @adequacy1 , please make sure you are using a valid Outline access key (example key: ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTo1UkVmeFRqbHR6Mkw@outline-server.example.com:17178/?outline=1). I don't see any @ or : or port numbers in your key, and they are all required.

jyyi1 avatar Jul 26 '24 20:07 jyyi1

Got it. This is the key to VPN Generator (vpngen.org). I thought it was your colleagues. But no, they changed the format of the key and thus made it impossible to use them on many linux distributions. It's just strange that the same key is normally accepted by your other Outline GUI clients. Update: Added missing parameters to the key, outline-cli starts, but no connection, no site opens. Arch linux updated. Is there any way to do debugging?

adequacy1 avatar Jul 27 '24 04:07 adequacy1

I see, we don't have any information about vpngen.org. It's possible their new keys don't work with Outline. For troubleshooting, check the source code here: https://github.com/Jigsaw-Code/outline-sdk/blob/main/x/examples/outline-cli/app_linux.go

Maybe double check your DNS settings (no internet if using a local DNS like 192.168.x.x) and, whether the server supports TCP/UDP over Shadowsocks.

jyyi1 avatar Jul 29 '24 22:07 jyyi1

Now vpngen.org has corrected the issuing of keys and they started to work normally with outline-cli. But I found it more convenient to use shadowsocks-rust client in socks-proxy mode (the same keys work with it). Thank you for your answers, it made a lot of sense!

adequacy1 avatar Jul 30 '24 04:07 adequacy1

Thanks for the information, I will close this issue.

jyyi1 avatar Aug 01 '24 15:08 jyyi1