linksharing

package module
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

README

Building

$ go install storj.io/linksharing

Configuring

Development

Default development configuration has the link sharing service hosted on localhost:8080 serving plain HTTP.

$ linksharing setup --defaults dev
Production

To configure the link sharing service for production, run the setup command using the release defaults. An required argument is the location of the geo-location database. You must also provide the public URL for the sharing service, which is used to construct URLs returned to clients. Since there is currently no server affinity for requests, the URL can point to a pool of servers:

$ linksharing setup --defaults release --geo-location-db <PATH TO FILE> --public-url <PUBLIC URL>

NOTE: Please follow this link for instructions how to install/download the geo-location database: https://dev.maxmind.com/geoip/geoipupdate/

Default release configuration has the link sharing service hosted on :8443 serving HTTPS using a server certificate (server.crt.pem) and key (server.key.pem) residing in the working directory where the linksharing service is run.

You can modify the configuration file or use the --cert-file and --key-file flags to configure an alternate location for the server keypair.

In order to run the link sharing service in release mode serving HTTP, you must clear the certificate and key file configurables:

$ linksharing setup --defaults release --public-url <PUBLIC URL> --cert-file="" --key-file="" --address=":8080"

WARNING HTTP is only recommended if you are doing TLS termination on the same machine running the link sharing service as the link sharing service serves unencrypted user data.

Running

After configuration is complete, running the link sharing is as simple as:

$ linksharing run

Anything shared with --url will be readonly and available publicly (no secret key needed).

uplink share --url sj://<path>

results in

https://link.us1.storjshare.io/s/jqaz8xihdea93jfbaks8324jrhq1/<path>

You can use your own domain and host your website on Storj with the following setup.

  1. Upload your static site and other files to Storj using Uplink or S3 gateway. Download the Uplink Binary.

  2. Share an object or path to an object. If you are sharing an entire bucket or sub-folder, you will want to name your home page index.html. Anything shared with --dns will be readonly and available publicly (no secret key needed).

    uplink share --dns <hostname> sj://<path>

    Prints a zone file with the information needed to create 3 dns records. Remember to update the $ORIGIN with your domain name. You may also change the $TTL.

    $ORIGIN example.com.
    $TTL    3600
    <hostname>    	IN	CNAME	link.us1.storjshare.io.
    txt-<hostname> 	IN	TXT  	storj-root:<path>
    txt-<hostname> 	IN	TXT  	storj-access:<access key>
    

    For example uplink share --dns www sj://bucket/prefix will output:

    $ORIGIN example.com.
    $TTL    3600
    www    	IN	CNAME	link.us1.storjshare.io.
    txt-www	IN	TXT  	storj-root:bucket/prefix
    txt-www	IN	TXT  	storj-access:jqaz8xihdea93jfbaks8324jrhq1
    
  3. Create a CNAME record on your hostname using our linksharing common URL link.us1.storjshare.io. as the target name.

  4. Create 2 TXT records, prepending txt- to your hostname.

    a. Root Path: the bucket, object prefix key, or individual object that you want your root domain to resolve to.

    b. Access Key: the readonly and public access key to your root path.

  5. You can check to make sure your dns records are ready with dig @1.1.1.1 txt-<hostname>.<domain> TXT

  6. Without further action, your site will be served with http. You can secure your site by using a https proxy server such as Cloudflare

  7. Optionally, if you create a page titled '404.html' in the root of your shared prefix, it will be served in 404 conditions.

  8. That's it! You should be all set to access your website e.g. http://www.example.test

LICENSE

This project is licensed under the AGPL-v3. See LICENSE for more.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.3.0

type Config struct {
	Server  httpserver.Config
	Handler sharing.Config

	// Maxmind geolocation database path.
	GeoLocationDB string
}

Config contains configurable values for sno registration Peer.

type Peer added in v1.3.0

type Peer struct {
	Log    *zap.Logger
	Mapper *objectmap.IPDB
	Server *httpserver.Server
}

Peer is the representation of a Linksharing service itself.

architecture: Peer

func New added in v1.3.0

func New(log *zap.Logger, config Config) (_ *Peer, err error)

New is a constructor for Linksharing Peer.

func (*Peer) Close added in v1.3.0

func (peer *Peer) Close() error

Close closes all underlying resources.

func (*Peer) Run added in v1.3.0

func (peer *Peer) Run(ctx context.Context) error

Run runs SNO registration service until it's either closed or it errors.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL