Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
86455b81
Commit
86455b81
authored
Feb 02, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(config) add GCR config section
parent
eeae42b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
repo/config/config.go
repo/config/config.go
+1
-0
repo/config/gcr_servers.go
repo/config/gcr_servers.go
+33
-0
repo/config/init.go
repo/config/init.go
+6
-0
No files found.
repo/config/config.go
View file @
86455b81
...
...
@@ -24,6 +24,7 @@ type Config struct {
Bootstrap
[]
string
// local nodes's bootstrap peer addresses
Tour
Tour
// local node's tour position
Gateway
Gateway
// local node's gateway server options
GCR
GCR
// local node's routing servers (if GCR enabled)
Log
Log
}
...
...
repo/config/gcr_servers.go
0 → 100644
View file @
86455b81
package
config
import
"github.com/jbenet/go-ipfs/util/ipfsaddr"
// TODO replace with final servers before merge
type
GCR
struct
{
Servers
[]
string
}
var
DefaultGCRServers
=
[]
string
{
"/ip4/104.236.70.34/tcp/4001/QmaWJw5mcWkCThPtC7hVq28e3WbwLHnWF8HbMNJrRDybE4"
,
"/ip4/128.199.72.111/tcp/4001/Qmd2cSiZUt7vhiuTmqBB7XWbkuFR8KMLiEuQssjyNXyaZT"
,
}
func
initGCR
()
(
*
GCR
,
error
)
{
// TODO perform validation
return
&
GCR
{
Servers
:
DefaultGCRServers
,
},
nil
}
func
(
gcr
*
GCR
)
ServerIPFSAddrs
()
([]
ipfsaddr
.
IPFSAddr
,
error
)
{
var
addrs
[]
ipfsaddr
.
IPFSAddr
for
_
,
server
:=
range
gcr
.
Servers
{
addr
,
err
:=
ipfsaddr
.
ParseString
(
server
)
if
err
!=
nil
{
return
nil
,
err
}
addrs
=
append
(
addrs
,
addr
)
}
return
addrs
,
nil
}
repo/config/init.go
View file @
86455b81
...
...
@@ -26,6 +26,11 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
return
nil
,
err
}
gcr
,
err
:=
initGCR
()
if
err
!=
nil
{
return
nil
,
err
}
conf
:=
&
Config
{
// setup the node's default addresses.
...
...
@@ -40,6 +45,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
},
Bootstrap
:
BootstrapPeerStrings
(
bootstrapPeers
),
GCR
:
*
gcr
,
Datastore
:
*
ds
,
Identity
:
identity
,
Log
:
Log
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment