Skip to content

Latest commit

 

History

History
executable file
·
470 lines (368 loc) · 8.96 KB

tinc_web.md

File metadata and controls

executable file
·
470 lines (368 loc) · 8.96 KB

TincWeb

Public Tinc-Web API (json-rpc 2.0)

TincWeb.Networks

List of available networks (briefly, without config)

  • Method: TincWeb.Networks
  • Returns: []*Network
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Networks",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

TincWeb.Network

Detailed network info

  • Method: TincWeb.Network

  • Returns: *Network

  • Arguments:

Position Name Type
0 name string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Network",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

TincWeb.Create

Create new network if not exists

  • Method: TincWeb.Create

  • Returns: *Network

  • Arguments:

Position Name Type
0 name string
1 subnet string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Create",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

TincWeb.Remove

Remove network (returns true if network existed)

  • Method: TincWeb.Remove

  • Returns: bool

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Remove",
    "params" : []
}
EOF

TincWeb.Start

Start or re-start network

  • Method: TincWeb.Start

  • Returns: *Network

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Start",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

TincWeb.Stop

Stop network

  • Method: TincWeb.Stop

  • Returns: *Network

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Stop",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

TincWeb.Peers

Peers brief list in network (briefly, without config)

  • Method: TincWeb.Peers

  • Returns: []*PeerInfo

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Peers",
    "params" : []
}
EOF

PeerInfo

Json Type Comment
name string
online bool
config network.Node

TincWeb.Peer

Peer detailed info by in the network

  • Method: TincWeb.Peer

  • Returns: *PeerInfo

  • Arguments:

Position Name Type
0 network string
1 name string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Peer",
    "params" : []
}
EOF

PeerInfo

Json Type Comment
name string
online bool
config network.Node

TincWeb.Import

Import another tinc-web network configuration file. It means let nodes defined in config join to the network. Return created (or used) network with full configuration

  • Method: TincWeb.Import

  • Returns: *Network

  • Arguments:

Position Name Type
0 sharing Sharing
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Import",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config

Sharing

Json Type Comment
name string
subnet string
node []*network.Node

TincWeb.Share

Share network and generate configuration file.

  • Method: TincWeb.Share

  • Returns: *Sharing

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Share",
    "params" : []
}
EOF

Sharing

Json Type Comment
name string
subnet string
node []*network.Node

TincWeb.Node

Node definition in network (aka - self node)

  • Method: TincWeb.Node

  • Returns: *network.Node

  • Arguments:

Position Name Type
0 network string
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Node",
    "params" : []
}
EOF

Node

Json Type Comment
name string
subnet string
port uint16
ip string
address []Address
publicKey string
version int

TincWeb.Upgrade

Upgrade node parameters. In some cases requires restart

  • Method: TincWeb.Upgrade

  • Returns: *network.Node

  • Arguments:

Position Name Type
0 network string
1 update Upgrade
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Upgrade",
    "params" : []
}
EOF

Node

Json Type Comment
name string
subnet string
port uint16
ip string
address []Address
publicKey string
version int

Upgrade

Json Type Comment
port uint16
address []Address
device string

TincWeb.Majordomo

Generate Majordomo request for easy-sharing

  • Method: TincWeb.Majordomo

  • Returns: string

  • Arguments:

Position Name Type
0 network string
1 lifetime Duration
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Majordomo",
    "params" : []
}
EOF

Duration

type Duration int64

TincWeb.Join

Join by Majordomo Link

  • Method: TincWeb.Join

  • Returns: *Network

  • Arguments:

Position Name Type
0 url string
1 start bool
curl -H 'Content-Type: application/json' --data-binary @- "http://127.0.0.1:8686/api/" <<EOF
{
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "TincWeb.Join",
    "params" : []
}
EOF

Network

Json Type Comment
name string
running bool
config *network.Config