func (db *DB) saveAddressToFile(info *addressInfo) {

	var addressDBPath = path.Join(db.filePath, addressDBFileName)

	//Store the addresss in disk
	fp, err := os.OpenFile(addressDBPath, os.O_APPEND|os.O_WRONLY, 0644)
	if err != nil {
		log.Fatal(err)
	}
	defer fp.Close()

	//SErialization of the address info
	addressInfoBytes := serializeAddressInfo(info)

	//Write serialization to the file
	n, err := fp.Write(addressInfoBytes)
	log.Println("Appended", n, "bytes to DB file.")
	if err != nil {
		log.Fatalln("Write failed:", err)
	}

	log.Println("Address " + net.IP(info.address[:]).String() + " added to DB")
}
//saveAddressToFile adds a new address to database file
saveAddressToFile adds a new address to database file
// saveAddressToFile adds a new address to database file
func (db *DB) saveAddressToFile(info *addressInfo) {
	var addressDBPath = path.Join(db.filePath, addressDBFileName)
	fp, err := os.OpenFile(addressDBPath, os.O_APPEND|os.O_WRONLY, 0644)
	if err != nil {
		log.Fatal(err)
	}
	defer fp.Close()
	addressInfoBytes := serializeAddressInfo(info)
	n, err := fp.Write(addressInfoBytes)
	log.Println("Appended", n, "bytes to DB file.")
	if err != nil {
		log.Fatalln("Write failed:", err)
	}
	log.Println("Address " + net.IP(info.address[:]).String() + " added to DB")
}
func ( db * DB ) saveAddressToFile ( info * addressInfo ) { var addressDBPath = path . Join ( db . filePath , addressDBFileName ) fp , err := os . OpenFile ( addressDBPath , os . O_APPEND | os . O_WRONLY , 0644 ) if err != nil { log . Fatal ( err ) } defer fp . Close ( ) addressInfoBytes := serializeAddressInfo ( info ) n , err := fp . Write ( addressInfoBytes ) log . Println ( " " , n , " " ) if err != nil { log . Fatalln ( " " , err ) } log . Println ( " " + net . IP ( info . address [ : ] ) . String ( ) + " " ) }
saveAddressToFile adds a new address to database file
saveAddressToFile adds a new address to database file
//Store the addresss in disk //SErialization of the address info //Write serialization to the file