-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathOceanNode.ts
More file actions
208 lines (194 loc) · 5.22 KB
/
OceanNode.ts
File metadata and controls
208 lines (194 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import { Stream } from 'stream'
import { RPCS } from './blockchain'
import { C2DClusterInfo, C2DDockerConfig } from './C2D/C2D'
import { FeeStrategy } from './Fees'
import { Schema } from '../components/database'
import { KeyProviderType } from './KeyManager'
import type { PersistentStorageConfig } from './PersistentStorage.js'
import type { AccessList } from './AccessList'
export interface OceanNodeDBConfig {
url: string | null
username?: string
password?: string
dbType: string | null
}
// deny list of peer ids and ips (for rate limiting purposes)
export interface DenyList {
peers: string[]
ips: string[]
}
export interface OceanNodeKeys {
peerId: any
publicKey: any
privateKey: any
ethAddress: string
type?: KeyProviderType
// Raw private key config (when type is 'raw')
// GCP KMS config (when type is 'gcp-kms')
gcpKmsConfig?: {
projectId: string
location: string
keyRing: string
keyName: string
keyVersion?: string
}
}
/* eslint-disable no-unused-vars */
export enum dhtFilterMethod {
filterPrivate = 'filterPrivate', // default, remove all private addresses from DHT
filterPublic = 'filterPublic', // remove all public addresses from DHT
filterNone = 'filterNone' // do not remove all any addresses from DHT
}
export interface OceanNodeP2PConfig {
bootstrapNodes: string[]
bootstrapTimeout: number
bootstrapTagName: string
bootstrapTagValue: number
bootstrapTTL: number
enableIPV4: boolean
enableIPV6: boolean
ipV4BindAddress: string | null
ipV4BindTcpPort: number | null
ipV4BindWsPort: number | null
ipV4BindWssPort: number | null
ipV6BindAddress: string | null
ipV6BindTcpPort: number | null
ipV6BindWsPort: number | null
pubsubPeerDiscoveryInterval: number
dhtMaxInboundStreams: number
dhtMaxOutboundStreams: number
dhtFilter: dhtFilterMethod
mDNSInterval: number
connectionsMaxParallelDials: number
connectionsDialTimeout: number
announceAddresses: string[]
filterAnnouncedAddresses: string[]
autoNat: boolean
upnp: boolean
enableCircuitRelayServer: boolean
enableCircuitRelayClient: boolean
circuitRelays: number
announcePrivateIp: boolean
minConnections: number
maxConnections: number
autoDialPeerRetryThreshold: number
autoDialConcurrency: number
maxPeerAddrsToDial: number
autoDialInterval: number
enableNetworkStats: boolean
}
export interface OceanNodeDockerConfig {
socketPath?: string
protocol?: string
host?: string
port?: number
caPath?: string
certPath?: string
keyPath?: string
}
export interface AccessListContract {
[chainId: string]: string[]
}
export interface dockerRegistryAuth {
username?: string
password?: string
auth?: string
}
export interface dockerRegistrysAuth {
[registry: string]: dockerRegistryAuth
}
export interface OceanNodeConfig {
dockerComputeEnvironments: C2DDockerConfig[]
dockerRegistrysAuth: dockerRegistrysAuth
authorizedDecrypters: string[]
authorizedDecryptersList: AccessListContract | null
allowedValidators: string[]
allowedValidatorsList: AccessListContract | null
authorizedPublishers: string[]
authorizedPublishersList: AccessListContract | null
keys: OceanNodeKeys
hasP2P: boolean
p2pConfig: OceanNodeP2PConfig | null
hasIndexer: boolean
hasHttp: boolean
dbConfig?: OceanNodeDBConfig
httpPort: number
feeStrategy: FeeStrategy
ipfsGateway?: string | null
arweaveGateway?: string | null
supportedNetworks?: RPCS
claimDurationTimeout: number
indexingNetworks?: RPCS
c2dClusters: C2DClusterInfo[]
accountPurgatoryUrl: string | null
assetPurgatoryUrl: string | null
allowedAdmins?: string[]
allowedAdminsList?: AccessListContract | null
codeHash?: string
rateLimit?: number // per request ip or peer
maxConnections?: number // global, regardless of client address(es)
denyList?: DenyList
unsafeURLs?: string[]
isBootstrap?: boolean
validateUnsignedDDO?: boolean
jwtSecret?: string
httpCertPath?: string
httpKeyPath?: string
enableBenchmark?: boolean
persistentStorage?: PersistentStorageConfig
}
export interface P2PStatusResponse {
httpStatus: number
error?: string
headers?: any
}
export interface P2PCommandResponse {
status: P2PStatusResponse
stream: Stream | null
}
export interface OceanNodeProvider {
chainId: string
network: string
}
export interface OceanNodeIndexer {
chainId: string
network: string
block?: string // mark it as optional until the functionality is done
}
export interface StorageTypes {
ipfs: boolean
arwave: boolean
url: boolean
}
export interface AddressPerChain {
[chainId: string]: string
}
export interface OceanNodeStatus {
id: string
publicKey: string
friendlyName: string
address: string
version: string
http: boolean
p2p: boolean
provider: OceanNodeProvider[]
indexer: OceanNodeIndexer[]
escrowAddress: AddressPerChain
supportedStorage: StorageTypes
platform: any
uptime?: number // seconds since start
codeHash?: string
allowedAdmins?: { addresses: string[]; accessLists: AccessListContract }
// detailed information
c2dClusters?: any[]
supportedSchemas?: Schema[]
persistentStorage?: {
accessLists?: AccessList[]
}
}
export interface FindDDOResponse {
provider: string
id: string
lastUpdateTx: string
lastUpdateTime: string
}