comparison src/luan/modules/IoLuan.java @ 1562:b89212fd04b5

remove table.luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Nov 2020 16:50:59 -0700
parents 0ba144491a42
children 8fbcc4747091
comparison
equal deleted inserted replaced
1561:e1a13e707bf3 1562:b89212fd04b5
426 426
427 public LuanTable children(Luan luan) throws LuanException { 427 public LuanTable children(Luan luan) throws LuanException {
428 File[] files = file.listFiles(); 428 File[] files = file.listFiles();
429 if( files==null ) 429 if( files==null )
430 return null; 430 return null;
431 LuanTable list = new LuanTable(luan); 431 LuanTable list = new LuanTable();
432 for( File f : files ) { 432 for( File f : files ) {
433 list.rawPut(list.rawLength()+1,new LuanFile(luan,f)); 433 list.rawPut(list.rawLength()+1,new LuanFile(luan,f));
434 } 434 }
435 return list; 435 return list;
436 } 436 }
628 return null; 628 return null;
629 } 629 }
630 } 630 }
631 631
632 public static LuanTable my_ips(Luan luan) throws IOException, LuanException { 632 public static LuanTable my_ips(Luan luan) throws IOException, LuanException {
633 LuanTable tbl = new LuanTable(luan); 633 LuanTable tbl = new LuanTable();
634 for( Enumeration<NetworkInterface> e1 = NetworkInterface.getNetworkInterfaces(); e1.hasMoreElements(); ) { 634 for( Enumeration<NetworkInterface> e1 = NetworkInterface.getNetworkInterfaces(); e1.hasMoreElements(); ) {
635 NetworkInterface ni = e1.nextElement(); 635 NetworkInterface ni = e1.nextElement();
636 for( Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements(); ) { 636 for( Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements(); ) {
637 InetAddress ia = e2.nextElement(); 637 InetAddress ia = e2.nextElement();
638 if( ia instanceof Inet4Address ) 638 if( ia instanceof Inet4Address )
639 tbl.put(ia.getHostAddress(),true); 639 tbl.put(luan,ia.getHostAddress(),true);
640 } 640 }
641 } 641 }
642 return tbl; 642 return tbl;
643 } 643 }
644 644
645 public static LuanTable dns_lookup(Luan luan,String domain,String type) 645 public static LuanTable dns_lookup(String domain,String type)
646 throws NamingException 646 throws NamingException
647 { 647 {
648 LuanTable tbl = new LuanTable(luan); 648 LuanTable tbl = new LuanTable();
649 InitialDirContext idc = new InitialDirContext(); 649 InitialDirContext idc = new InitialDirContext();
650 Attribute attribute; 650 Attribute attribute;
651 try { 651 try {
652 attribute = idc.getAttributes("dns:/" + domain, new String[] {type}).get(type); 652 attribute = idc.getAttributes("dns:/" + domain, new String[] {type}).get(type);
653 } catch(NameNotFoundException e) { 653 } catch(NameNotFoundException e) {