eskipfile

package
v0.24.86 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 10

Documentation

Overview

Package eskipfile implements the DataClient interface for reading the skipper route definitions from an eskip formatted file.

(See the DataClient interface in the skipper/routing package and the eskip format in the skipper/eskip package.)

The package provides two implementations: one without file watch (legacy version) and one with file watch. When running the skipper command, the one with watch is used.

Example
package main

import (
	"github.com/zalando/skipper/eskipfile"
	"github.com/zalando/skipper/proxy"
	"github.com/zalando/skipper/routing"
)

func main() {
	// open file with a routing table:
	dataClient := eskipfile.Watch("/some/path/to/routing-table.eskip")
	defer dataClient.Close()

	// create a routing object:
	rt := routing.New(routing.Options{
		DataClients: []routing.DataClient{dataClient},
	})
	defer rt.Close()

	// create an http.Handler:
	p := proxy.New(rt, proxy.OptionsNone)
	defer p.Close()
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoteWatch added in v0.13.41

func RemoteWatch(o *RemoteWatchOptions) (routing.DataClient, error)

RemoteWatch creates a route configuration client with (remote) file watching. Watch doesn't follow file system nodes, it always reads (or re-downloads) from the file identified by the initially provided file name.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client contains the route definitions from an eskip file, if you need file watch use WatchClient instead.

Use the Open function to create instances of Client.

func Open

func Open(path string) (*Client, error)

Open opens an eskip file and parses it, returning a DataClient implementation. If reading or parsing the file fails, returns an error. This implementation doesn't provide file watch.

func (Client) LoadAll

func (c Client) LoadAll() ([]*eskip.Route, error)

LoadAll returns the parsed route definitions found in the file.

func (Client) LoadAndParseAll

func (c Client) LoadAndParseAll() (routeInfos []*eskip.RouteInfo, err error)

func (Client) LoadUpdate

func (c Client) LoadUpdate() ([]*eskip.Route, []string, error)

LoadUpdate is a noop.

func (Client) Name added in v0.24.85

func (Client) Name() string

type RemoteWatchOptions added in v0.13.41

type RemoteWatchOptions struct {
	// URL of the route file
	RemoteFile string

	// Verbose mode for the dataClient
	Verbose bool

	// Amount of route changes that will trigger logs after route updates
	Threshold int

	// It does an initial download and parsing of remote routes, and makes RemoteWatch to return an error
	FailOnStartup bool

	// HTTPTimeout is the generic timeout for any phase of a single HTTP request to RemoteFile.
	HTTPTimeout time.Duration
}

type WatchClient added in v0.9.206

type WatchClient struct {
	// contains filtered or unexported fields
}

WatchClient implements a route configuration client with file watching. Use the Watch function to initialize instances of it.

func Watch added in v0.9.206

func Watch(name string) *WatchClient

Watch creates a route configuration client with file watching. Watch doesn't follow file system nodes, it always reads from the file identified by the initially provided file name.

func (*WatchClient) Close added in v0.9.206

func (c *WatchClient) Close()

Close stops watching the configured file and providing updates.

func (*WatchClient) LoadAll added in v0.9.206

func (c *WatchClient) LoadAll() ([]*eskip.Route, error)

LoadAll returns the parsed route definitions found in the file.

func (*WatchClient) LoadUpdate added in v0.9.206

func (c *WatchClient) LoadUpdate() ([]*eskip.Route, []string, error)

LoadUpdate returns differential updates when a watched file has changed.

func (*WatchClient) Name added in v0.24.85

func (*WatchClient) Name() string

Jump to

Keyboard shortcuts

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