<commit_before>package Funknet::Config::Tunnel;
use strict;

use Funknet::Config::Validate qw/ is_ipv4 is_ipv6 is_valid_type /;
use Funknet::Config::Tunnel::BSD;
use Funknet::Config::Tunnel::IOS;
use Funknet::Config::Tunnel::Linux;
use Funknet::Config::Tunnel::Solaris;

=head1 NAME

Funknet::Config::Tunnel

=head1 DESCRIPTION

This is the generic Tunnel class. It reads the local_os parameter set
by higher-level code, and calls the appropriate routines in the
OS-specific classes, returning an object blessed into a specific
class.

=head1 EXTENDING

Adding a new OS' tunnel implementation requires the following changes:
extend sub new to read the new local_os parameter; likewise
new_from_ifconfig. Add a new module Funknet::Config::Tunnel::NewOS.pm
and use it in this module. Add the new OS' local_os flag to
Funknet::Config::Validate.pm. Implement specific methods in NewOS.pm. 

=cut

sub new {
    my ($class, %args) = @_;
    my $self = bless {}, $class;

    unless (defined $args{source} && ($args{source} eq 'whois' || $args{source} eq 'host')) {
	warn "missing source";
	return undef;
    } else {
	$self->{_source} = $args{source};
    }

    unless (defined $args{type} && is_valid_type($args{type})) {
	warn "missing or invalid type";
	return undef;
    } else {
	$self->{_type} = $args{type};
    }
    
    if ($self->{_type} eq 'sit') {
	$self->{_proto} = 'IPv6';
    } else {
	$self->{_proto} = 'IPv4';
    }
    <commit_msg>ignore the relevant interfaces, take list from ConfigFile module<commit_after>package Funknet::Config::Tunnel;
use strict;

use Funknet::Config::Validate qw/ is_ipv4 is_ipv6 is_valid_type /;
use Funknet::Config::Tunnel::BSD;
use Funknet::Config::Tunnel::IOS;
use Funknet::Config::Tunnel::Linux;
use Funknet::Config::Tunnel::Solaris;

=head1 NAME

Funknet::Config::Tunnel

=head1 DESCRIPTION

This is the generic Tunnel class. It reads the local_os parameter set
by higher-level code, and calls the appropriate routines in the
OS-specific classes, returning an object blessed into a specific
class.

=head1 EXTENDING

Adding a new OS' tunnel implementation requires the following changes:
extend sub new to read the new local_os parameter; likewise
new_from_ifconfig. Add a new module Funknet::Config::Tunnel::NewOS.pm
and use it in this module. Add the new OS' local_os flag to
Funknet::Config::Validate.pm. Implement specific methods in NewOS.pm. 

=cut

sub new {
    my ($class, %args) = @_;
    my $self = bless {}, $class;

    # is this an interface we should be ignoring?

    my @ignore_if = Funknet::Config::ConfigFile->ignore_if;
    if (defined $args{ifname} && (grep /$args{ifname}/, @ignore_if)) {
	warn "ignoring $args{ifname}";
	return undef;
    }
    
    unless (defined $args{source} && ($args{source} eq 'whois' || $args{source} eq 'host')) {
	warn "missing source";
	return undef;
    } else {
	$self->{_source} = $args{source};
    }

    unless (defined $args{type} && is_valid_type($args{type})) {
	warn "missing or invalid type";
	return undef;
    } else {
	$self->{_type} = $args{type};
    }
    
    if ($self->{_type} eq 'sit') {
	$self->{_proto} = 'IPv6';
    } else {
	$self->{_proto} = 'IPv4';
    }
    
{'fraction_non_alphanumeric': 0.13415017279296262, 'fraction_numerical': 0.004398366321080742, 'mean_word_length': 4.315525876460768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2857597', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1072, 'n_words': 334}