hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

types.ha (1006B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 use net::ip;
      5 
      6 // A list of [[net::ip::subnet]]s.
      7 export type subnet_list = []ip::subnet;
      8 
      9 // Values set in an "options" directive.
     10 export type options = struct {
     11 	debug: bool,
     12 	ndots: uint,
     13 	timeout: uint,
     14 	attempts: uint,
     15 	rotate: bool,
     16 	no_aaaa: bool,
     17 	no_check_names: bool,
     18 	inet6: bool,
     19 	edns0: bool,
     20 	single_request: bool,
     21 	single_request_reopen: bool,
     22 	no_tld_query: bool,
     23 	use_vc: bool,
     24 	no_reload: bool,
     25 	trust_ad: bool,
     26 };
     27 
     28 def DEFAULT_OPTIONS = options {
     29 	ndots = 1,
     30 	timeout = 5,
     31 	attempts = 2,
     32 	...
     33 };
     34 
     35 // The value associated with a configuration parameter.
     36 export type value = (ip::addr | subnet_list | *options | []str);
     37 
     38 // A configuration parameter from resolv.conf.
     39 export type parameter = struct {
     40 	name: const str,
     41 	value: value,
     42 };
     43 
     44 // A complete configuration parsed from resolv.conf.
     45 export type config = struct {
     46 	nameservers: []ip::addr,
     47 	search: []str,
     48 	sortlist: []ip::subnet,
     49 	options: options,
     50 };