Commit Graph

44 Commits

Author SHA1 Message Date
Dave Collins
766aae5a72 Add rolling log file.
This commit modifies the logging to also log all output to a rolling log
file in the btcd home directory under the logs folder.  It uses a maximum
size of 10MB per log file and a max rotation size of 3.  This means the
log files will not exceed 30 megabytes.
2013-11-25 13:40:53 -06:00
Dave Collins
8e3ede441b Update for recent go-flags API changes. 2013-11-24 12:33:36 -06:00
Dave Collins
a9bf28af4d Allow the overall log level to be dynamically set.
The code was previously only changing the logging level if it wasn't the
default which is accurate for setting the log level once at startup time,
but it needs to set it unconditionally to allow dynamic updates.
2013-11-22 12:46:44 -06:00
Dave Collins
daa5310e2f Add support for debuglevel RPC command.
Also include the supported subsystems in the error message if an invalid
subsystem is specified.

Closes #15.
2013-11-22 10:47:29 -06:00
Dave Collins
48ab97c271 Allow per-subsystem log levels to be specified.
Now that each subsystem is capable of having its own log level, modify the
-d/--debuglevel flag to allow them to be specified.

Closes #48.
2013-11-21 17:41:45 -06:00
Dave Collins
eb8688df79 Convert btcd to use new btclog package.
Also, make every subsystem within btcd use its own logger instance so each
subsystem can have its own level specified independent of the others.

This is work towards #48.
2013-11-21 17:41:21 -06:00
Dave Collins
f5a7dcdcbf Default RPC server listener to localhost. 2013-11-19 17:33:36 -06:00
Dave Collins
02e6d47590 Return error on dir create failure from loadConfig.
Rather than simply exiting on a home directory creation error, return the
error so it exits via the normal path.
2013-11-19 15:56:21 -06:00
David Hill
35eea401e1 Create the home directory if it doesn't exist. 2013-11-19 16:40:20 -05:00
Dave Collins
9a853fdf90 Use single cert/key for RPC by default.
Also, while here, set the default RPC cert/key in the initial config
struct so the default will show when displaying the usage.
2013-11-19 11:38:46 -06:00
Dave Collins
22600c7c67 Correct a couple of usage inconsistencies.
- Remove periods from --rpccert/--rpckey since none of the other options use
  them
- Make it a little more clear that the --listen and --rpclisten options can be
  used multiple times by changing the summary to start with "Add an ..."
  which also matches the --addpeer style
2013-11-19 10:39:38 -06:00
Owain G. Ainsworth
75e577c82e RPC TLS Support.
All rpc sockets now listen using TLS by default, and this can not be
turned off. The keys (defauling to the datadirectory) may be provided by
--rpccert and --rpckey. If the keys do not exist we will generate a new
self-signed keypair with some sane defaults (hostname and all current
interface addresses).

Additionally add tls capability to btcctl so that it can still be used.
The certificate to use for verify can be provided on the commandline or
verification can be turned off (this leaves you susceptible to MITM
attacks)

Initial code from dhill (rpc tls support) and jrick (key generation),
cleanup, debugging and polishing from me.
2013-11-19 14:50:31 +00:00
Owain G. Ainsworth
5da5dfe1c4 Add --rpclisten that behaves frighteningly similar to --listen.
Except it works for the rpcserver instead of the main server.

Closes #34
2013-11-19 14:48:58 +00:00
Dave Collins
5bf879dcfc Minor cleanup of some documentation and comments. 2013-11-18 10:38:24 -06:00
Dave Collins
6b8c10d1fb Don't load default config file in regtest mode.
The regression test mode is special and therefore most likely will not
want to use the same settings that are in the configuration file.  The -C
option can still be used to specify a config file in regression test mode
if desired.
2013-11-15 14:43:36 -06:00
Dave Collins
9fb17c3a6d Improve usage display a little.
This commit makes use of the new default-mask go-flags option in
conjunction with delaying the usage display until after the config file is
parsed.  This has a couple of nice properties such as showing the actual
values that will be used as loaded from the specific config file instead
of the defaults specified in btcd itself, and also allows any config file
parsing errors to be shown prior to displaying the usage.
2013-11-14 20:38:27 -06:00
Owain G. Ainsworth
6116a6cb02 Support --listen.
This allows the provision of address/port pairs to be listened on instead
of just providing the port. e.g.:
btcd --listen 1.2.3.4:4321 --listen 127.0.0.01 --listen [::1]:5432

When --proxy and --connect are used, we disable listening *unless* any --listen
arguments have been provided, when we will listen on those addresses as
requested.

Initial code by davec, integration by myself.

Closes #33

allow listens to fail, but warn. error if all failed

fmt
2013-11-14 01:15:47 +00:00
Dave Collins
72c186f9a9 Migrate to new app data directories.
This commit makes use of the new btcutil.AppDataDir function which chooses
appropriate data directories for each supported operating system.  It also
adds code to the upgrade path to properly migrate existing data from the
old to new locations.

This is part of work toward issue #30.
2013-11-11 10:58:38 -06:00
Dave Collins
7d8bb5ab4c Add --cpuprofile option.
This commit provides a new --cpuprofile flag that can be used to specify a
file path to write CPU profile data into.  The resulting profile can then be
consumed by the 'go tool pprof' command.
2013-10-26 16:13:50 -05:00
Dave Collins
36bd4b8994 Revert "Enable memdb support."
This reverts commit 1fadf619c7.
2013-10-26 01:58:50 -05:00
Dave Collins
1fadf619c7 Enable memdb support. 2013-10-25 21:41:17 -05:00
Dave Collins
8f75a09479 Remove sqlite as an available db type. 2013-10-22 15:01:51 -05:00
Owain G. Ainsworth
36c429c302 Bump maxpeers to 125 like bitcoind.
It helps a lot if our max peers doesn't equal the max we'll try and open
outbound.
2013-10-14 22:27:39 +01:00
Dave Collins
e04986528c Add --nocheckpoints option.
This commit provides a new flag, --nocheckpoints, to disable built-in
checkpoints.

Checkpoints are used for a number of things such a ensuring
the block chain being downloaded matches various known good blocks,
allowing quicker verification on old blocks since scripts don't have to be
executed, and preventing forks from old blocks, etc.
2013-10-09 19:34:02 -05:00
Dave Collins
c8160a57aa Switch to leveldb by default.
Also, add a warning if multiple block databases are detected.
2013-10-08 15:00:34 -05:00
Dave Collins
8364392037 Remove SeedPeer option as it's not implemented. 2013-10-04 00:46:03 -05:00
Dave Collins
6dbc61e960 Remove the noverify option.
This was a development only option.
2013-10-03 13:01:18 -05:00
Dave Collins
a5cc716940 Address some minor things reported by golint. 2013-09-18 00:36:40 -05:00
Dave Collins
465327c62d Expand environment variables in datadir.
This commit adds environment variable expansion and path cleaning to the
data directory.  This allows the user to specify data paths in the config
file such as datadir=~/.btcd/data and datadir=$SOMEVAR/btcd.  It also
adds usage instructions and an example to the sample btcd.conf file.
2013-09-18 00:16:57 -05:00
Dave Collins
fc0cd75046 gofmt. 2013-09-17 17:04:40 -05:00
Marco Peereboom
68f30c7367 add missing empty string test, pointed out by davec 2013-09-17 17:46:03 -04:00
Marco Peereboom
ada49f1413 Add a flag to enable live profiling.
The profile information can be seen with a browser on e.g.
http://localhost:6060/debug/pprof/
Alternatively, one can use the pprof tool as described at
http://golang.org/pkg/net/http/pprof/

ok davec
2013-09-17 17:40:27 -04:00
Dave Collins
f3cd8174bb Use the new btcdb.SupportedDBs for known db types. 2013-09-15 15:21:46 -05:00
Dave Collins
629a1c9d06 Rework the data path and db type handling.
This commit modifies the way the data paths are handled.  Since there will
ultimately be more data associated with each network than just the block
database, the data path has been modified to be "namespaced" based on the
network.  This allows all data associated with a specific network to
simply use the data path without having to worry about conflicts with data
from other networks.

In addition, this commit renames the block database to "blocks" plus a
suffix which denotes the database type.  This prevents issues that would
otherwise arise if the user decides to use a different database type and
a file/folder with the same name already eixsts but is of the old database
type.  For most users this won't matter, but it does provide nice
properties for testing and development as well since it makes it easy to
go back and forth between database types.

This commit also includes code to upgrade the old database paths to the
new ones so the change is seamless for the user.

Finally, bump the version to 0.2.0.
2013-09-15 14:25:32 -05:00
Dave Collins
1c9a7095b3 Change --dbdir flag to --datadir.
This change paves the way for saving more than just the block database to
the filesystem (such as address manager data, index data, etc) where the
name "dbdir" no longer makes sense.
2013-09-13 18:02:10 -05:00
Dave Collins
be3dc1837c Gofmt latest dbtype config additions. 2013-09-13 14:52:34 -05:00
Dale Rahn
af7aa39624 Allow config file and command line to select between sqlite and levdldb 2013-09-13 10:08:19 -04:00
Dave Collins
f7387f217a Remove current directory config autoload override.
This was a holder from before there was home directory based config.  The
user can use -C ./btcd.conf if that is the intended goal.
2013-08-19 14:48:46 -05:00
Dave Collins
627959adff Ignore config file addpeer entries with --regtest.
When running in regression test mode, it is unlikely the user wants to
connect to permanent peers they have configured in their config file.
This commit modifies the code to ignore the config file entry when in
regression test mode.  The user can still provide -a (or --addpeer) on the
command line to override this if they really want to connect out to a
specific peer during regression test mode.
2013-08-17 14:44:43 -05:00
Dave Collins
f80bc8c8f9 Misc comment and doco cleanup. 2013-08-08 12:47:15 -05:00
David Hill
52416ec28f new option --tor (requires --proxy)
Although not required if the proxy set is indeed Tor, setting this option
does the following:
   - Sends DNS queries over the Tor network (during dns seed lookup).  This
     stops your IP from being leaked via DNS.
   - Does not disable the listening port.  This allows the hidden services
     feature of Tor to be used.
2013-08-08 12:11:39 -04:00
David Hill
3f782928fd initial proxy code 2013-08-08 00:13:47 -05:00
Dave Collins
b759bafa60 Add version information and -V/--version flags. 2013-08-07 18:53:01 -05:00
Dave Collins
8574846e87 Move btcd to root directory.
This allows easier go get paths.
2013-08-07 12:47:51 -05:00