// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/acl/ACLItemMethod.java
// public enum ACLItemMethod {
//     DIRECT,
//     PROXY,
//     REJECT
// }
// 
// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/acl/ACLItemType.java
// public enum ACLItemType {
//     DOMAIN,
//     DOMAIN_SUFFIX,
//     IPv4,
//     IPv4_CIDR,
//     IPv6,
//     IPv6_CIDR
// }
// 
// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/exception/InvalidAddressException.java
// public class InvalidAddressException extends Exception {
// 
//     public InvalidAddressException(final String msg) {
//         super(msg);
//     }
// 
// }


import com.vecsight.dragonite.proxy.acl.ACLItemMethod;
import com.vecsight.dragonite.proxy.acl.ACLItemType;
import com.vecsight.dragonite.proxy.exception.InvalidAddressException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
/*
 * The Dragonite Project
 * -------------------------
 * See the LICENSE file in the root directory for license information.
 */


package com.vecsight.dragonite.proxy.acl.item;



public class IPv4ACLItem implements ACLItem {

    private final byte[] bytes;

    private final ACLItemMethod method;

    public IPv4ACLItem(final String string, final ACLItemMethod method) throws InvalidAddressException {
        this.method = method;
        try {
            bytes = InetAddress.getByName(string).getAddress();
            if (bytes.length != 4) throw new InvalidAddressException(string + " is not a valid IPv4 address");
        } catch (final UnknownHostException e) {
            throw new InvalidAddressException(string + " is not a valid IPv4 address");
        }
    }

    public IPv4ACLItem(final byte[] bytes, final ACLItemMethod method) {
// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/acl/ACLItemMethod.java
// public enum ACLItemMethod {
//     DIRECT,
//     PROXY,
//     REJECT
// }
// 
// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/acl/ACLItemType.java
// public enum ACLItemType {
//     DOMAIN,
//     DOMAIN_SUFFIX,
//     IPv4,
//     IPv4_CIDR,
//     IPv6,
//     IPv6_CIDR
// }
// 
// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/exception/InvalidAddressException.java
// public class InvalidAddressException extends Exception {
// 
//     public InvalidAddressException(final String msg) {
//         super(msg);
//     }
// 
// }


// Path: dragonite-proxy/src/main/java/com/vecsight/dragonite/proxy/acl/item/IPv4ACLItem.java
import com.vecsight.dragonite.proxy.acl.ACLItemMethod;
import com.vecsight.dragonite.proxy.acl.ACLItemType;
import com.vecsight.dragonite.proxy.exception.InvalidAddressException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

/*
 * The Dragonite Project
 * -------------------------
 * See the LICENSE file in the root directory for license information.
 */


package com.vecsight.dragonite.proxy.acl.item;



public class IPv4ACLItem implements ACLItem {

    private final byte[] bytes;

    private final ACLItemMethod method;

    public IPv4ACLItem(final String string, final ACLItemMethod method) throws InvalidAddressException {
        this.method = method;
        try {
            bytes = InetAddress.getByName(string).getAddress();
            if (bytes.length != 4) throw new InvalidAddressException(string + " is not a valid IPv4 address");
        } catch (final UnknownHostException e) {
            throw new InvalidAddressException(string + " is not a valid IPv4 address");
        }
    }

    public IPv4ACLItem(final byte[] bytes, final ACLItemMethod method) {
        this.method = method;