main
go 91 lines 3.33 KB
Raw
1 package types
2
3 type AgentStatusResponse struct {
4 ConfigPath string `json:"config_path,omitempty"`
5 ControlAddr string `json:"control_addr"`
6 WalletAddress string `json:"wallet_address,omitempty"`
7 Tunnels []AgentTunnelStatus `json:"tunnels,omitempty"`
8 }
9
10 type AgentTunnelStatus struct {
11 ID string `json:"id"`
12 Name string `json:"name,omitempty"`
13 Address string `json:"address,omitempty"`
14 State string `json:"state"`
15 TargetAddr string `json:"target_addr,omitempty"`
16 LastError string `json:"last_error,omitempty"`
17 Discovery bool `json:"discovery"`
18 MaxActiveRelays int `json:"max_active_relays,omitempty"`
19 Metadata LeaseMetadata `json:"metadata,omitempty"`
20 MultiHop []string `json:"multi_hop,omitempty"`
21 X402PayTo string `json:"x402_pay_to,omitempty"`
22 X402Testnet bool `json:"x402_testnet,omitempty"`
23 HTTPRoutes []AgentHTTPRoute `json:"http_routes,omitempty"`
24 Relays []AgentRelayStatus `json:"relays,omitempty"`
25 }
26
27 type AgentHTTPRoute struct {
28 Prefix string `json:"prefix"`
29 Upstream string `json:"upstream"`
30 Methods []string `json:"methods,omitempty"`
31 Amount string `json:"amount,omitempty"`
32 }
33
34 type AgentRelayStatus struct {
35 RelayURL string `json:"relay_url"`
36 PublicURL string `json:"public_url,omitempty"`
37 Version string `json:"version,omitempty"`
38 Explicit bool `json:"explicit,omitempty"`
39 Connecting bool `json:"connecting"`
40 Bootstrap bool `json:"bootstrap"`
41 Banned bool `json:"banned"`
42 SupportsOverlay bool `json:"supports_overlay"`
43 SupportsUDP bool `json:"supports_udp"`
44 SupportsTCP bool `json:"supports_tcp"`
45 }
46
47 type AgentTunnelRequest struct {
48 ID string `json:"id"`
49 Name string `json:"name,omitempty"`
50 TargetAddr string `json:"target_addr,omitempty"`
51 HTTPRoutes []AgentHTTPRoute `json:"http_routes,omitempty"`
52 RelayURLs []string `json:"relays,omitempty"`
53 Discovery *bool `json:"discovery,omitempty"`
54 MaxActiveRelays int `json:"max_active_relays,omitempty"`
55 X402PayTo string `json:"x402_pay_to,omitempty"`
56 X402Testnet bool `json:"x402_testnet,omitempty"`
57 }
58
59 type AgentRelayRequest struct {
60 RelayURL string `json:"relay_url"`
61 }
62
63 type AgentMultiHopRequest struct {
64 Relays []string `json:"relays"`
65 }
66
67 type AgentTunnelUpdateRequest struct {
68 MaxActiveRelays *int `json:"max_active_relays,omitempty"`
69 Metadata *AgentMetadataRequest `json:"metadata,omitempty"`
70 }
71
72 func (r AgentTunnelUpdateRequest) Empty() bool {
73 return r.MaxActiveRelays == nil &&
74 (r.Metadata == nil || r.Metadata.Empty())
75 }
76
77 type AgentMetadataRequest struct {
78 Description *string `json:"description,omitempty"`
79 Owner *string `json:"owner,omitempty"`
80 Thumbnail *string `json:"thumbnail,omitempty"`
81 Tags *[]string `json:"tags,omitempty"`
82 Hide *bool `json:"hide,omitempty"`
83 }
84
85 func (r AgentMetadataRequest) Empty() bool {
86 return r.Description == nil &&
87 r.Owner == nil &&
88 r.Thumbnail == nil &&
89 r.Tags == nil &&
90 r.Hide == nil
91 }