github.com/amazechain/amc@v0.1.3/conf/p2p_config.go (about)

     1  // Copyright 2022 The AmazeChain Authors
     2  // This file is part of the AmazeChain library.
     3  //
     4  // The AmazeChain library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The AmazeChain library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the AmazeChain library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package conf
    18  
    19  type NetWorkConfig struct {
    20  	ListenersAddress []string `json:"listeners" yaml:"listeners"`
    21  	BootstrapPeers   []string `json:"bootstraps" yaml:"bootstraps"`
    22  	LocalPeerKey     string   `json:"private" yaml:"network_private"`
    23  	Bootstrapped     bool     `json:"discover" yaml:"discover"`
    24  }
    25  
    26  type P2PConfig struct {
    27  	NoDiscovery         bool     `json:"no_discovery" yaml:"no_discovery"`
    28  	EnableUPnP          bool     `json:"enable_upnp" yaml:"enable_upnp"`
    29  	StaticPeerID        bool     `json:"static_peer_id" yaml:"static_peer_id"`
    30  	StaticPeers         []string `json:"static_peers" yaml:"static_peers"`
    31  	BootstrapNodeAddr   []string `json:"bootstrap_node_addr" yaml:"bootstrap_node_addr"`
    32  	Discv5BootStrapAddr []string `json:"discv5_bootstrap_addr" yaml:"discv5_bootstrap_addr"`
    33  	RelayNodeAddr       string   `json:"relay_node_addr" yaml:"relay_node_addr"`
    34  	LocalIP             string   `json:"local_ip" yaml:"local_ip"`
    35  	HostAddress         string   `json:"host_address" yaml:"host_address"`
    36  	HostDNS             string   `json:"host_dns" yaml:"host_dns"`
    37  	PrivateKey          string   `json:"private_key" yaml:"private_key"`
    38  	DataDir             string   `json:"data_dir" yaml:"data_dir"`
    39  	MetaDataDir         string   `json:"metadata_dir" yaml:"metadata_dir"`
    40  	TCPPort             int      `json:"tcp_port" yaml:"tcp_port"`
    41  	UDPPort             int      `json:"udp_port" yaml:"udp_port"`
    42  	MaxPeers            int      `json:"max_peers" yaml:"max_peers"`
    43  	AllowListCIDR       string   `json:"allow_list_cidr" yaml:"allow_list_cidr"`
    44  	DenyListCIDR        []string `json:"deny_list_cidr" yaml:"deny_list_cidr"`
    45  	MinSyncPeers        int      `json:"min_sync_peers" yaml:"min_sync_peers"`
    46  
    47  	P2PLimit *P2PLimit
    48  }
    49  
    50  type P2PLimit struct {
    51  	BlockBatchLimit            int `json:"block_batch_limit" yaml:"block_batch_limit"`
    52  	BlockBatchLimitBurstFactor int `json:"block_batch_limit_burst_factor" yaml:"block_batch_limit_burst_factor"`
    53  	BlockBatchLimiterPeriod    int `json:"block_batch_limiter_period" yaml:"block_batch_limiter_period"`
    54  }